Submission #1320844

#TimeUsernameProblemLanguageResultExecution timeMemory
1320844d_kPrisoner Challenge (IOI22_prison)C++20
Compilation error
0 ms0 KiB
#include "prison.h" #include <vector> #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans(n + 1, vector<int>(n + 1, 0)); int x = n; ans[0][0] = 0; for(int i = 0; i <= n; i++){ if(i == 1) ans[0][j] = -1; else if(i == N) ans[0][j] = -2; else ans[0][j] = j; } for(int i = 1; i <= x; i++){ for(int i = 1; j <= n; j++){ ans[i][0] = 1; if(j < i) ans[i][j] = -2; else if(j > i) ans[i][j] = -1; else ans[i][j] = 0; } } return ans; }

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:12:35: error: 'j' was not declared in this scope
   12 |                 if(i == 1) ans[0][j] = -1;
      |                                   ^
prison.cpp:13:30: error: 'N' was not declared in this scope
   13 |                 else if(i == N) ans[0][j] = -2;
      |                              ^
prison.cpp:13:40: error: 'j' was not declared in this scope
   13 |                 else if(i == N) ans[0][j] = -2;
      |                                        ^
prison.cpp:14:29: error: 'j' was not declared in this scope
   14 |                 else ans[0][j] = j;
      |                             ^
prison.cpp:17:32: error: 'j' was not declared in this scope
   17 |                 for(int i = 1; j <= n; j++){
      |                                ^