Submission #1079643

#TimeUsernameProblemLanguageResultExecution timeMemory
1079643beaconmcSoccer Stadium (IOI23_soccer)C++17
Compilation error
0 ms0 KiB
ll prefrow2[2001][2001]; ll prefcol2[2001][2001]; ll grid2[2001][2001]; bool checkrow2(ll a, ll b, ll row){ if (a>b) swap(a,b); return (prefrow2[row][b] - prefrow2[row][a] + grid2[row][a] == 0); } bool checkcol2(ll a, ll b, ll col){ if (a>b) swap(a,b); return (prefcol2[b][col] - prefcol2[a][col] + grid2[a][col] == 0); } int biggest_stadium(int N, std::vector<std::vector<int>> F) { ll ans = N*N; FOR(i,0,N){ FOR(j,0,N){ grid2[i][j] = F[i][j]; ans -= F[i][j]; } } FOR(i,0,N){ prefrow2[i][0] = F[i][0]; FOR(j,1,N){ prefrow2[i][j] = prefrow2[i][j-1] + F[i][j]; } } FOR(j,0,N){ prefcol2[0][j] = F[0][j]; FOR(i,1,N){ prefcol2[i][j] = prefcol2[i-1][j] + F[i][j]; } } vector<vector<ll>> special; FOR(i,0,N){ FOR(j,0,N){ vector<vector<ll>> sus = {{i-1,j}, {i+1,j}, {i,j-1}, {i,j+1}}; if (grid2[i][j] != 1){ bool flag = 0; for (auto&k : sus){ if (0<=k[0] && k[0]<N && 0<=k[1] && k[1]<N){ if (grid2[k[0]][k[1]]==1) flag = 1; } } if (flag==1 || i==0 || i==N-1 || j==0 || j==N-1) special.push_back({i,j}); } } } for (auto&X : special){ for (auto&Y : special){ ll i = X[0], j = X[1], k = Y[0], l= Y[1]; if (grid2[i][j]==1 || grid2[k][l] == 1) continue; bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l)); bool check2 = (checkrow2(l, j, k) && checkcol2(k, i, j)); if (!check1 && !check2) return 0; } } return ans; }

Compilation message (stderr)

soccer.cpp:3:1: error: 'll' does not name a type
    3 | ll prefrow2[2001][2001];
      | ^~
soccer.cpp:4:1: error: 'll' does not name a type
    4 | ll prefcol2[2001][2001];
      | ^~
soccer.cpp:5:1: error: 'll' does not name a type
    5 | ll grid2[2001][2001];
      | ^~
soccer.cpp:9:16: error: 'll' was not declared in this scope
    9 | bool checkrow2(ll a, ll b, ll row){
      |                ^~
soccer.cpp:9:22: error: 'll' was not declared in this scope
    9 | bool checkrow2(ll a, ll b, ll row){
      |                      ^~
soccer.cpp:9:28: error: 'll' was not declared in this scope
    9 | bool checkrow2(ll a, ll b, ll row){
      |                            ^~
soccer.cpp:9:34: error: expression list treated as compound expression in initializer [-fpermissive]
    9 | bool checkrow2(ll a, ll b, ll row){
      |                                  ^
soccer.cpp:16:16: error: 'll' was not declared in this scope
   16 | bool checkcol2(ll a, ll b, ll col){
      |                ^~
soccer.cpp:16:22: error: 'll' was not declared in this scope
   16 | bool checkcol2(ll a, ll b, ll col){
      |                      ^~
soccer.cpp:16:28: error: 'll' was not declared in this scope
   16 | bool checkcol2(ll a, ll b, ll col){
      |                            ^~
soccer.cpp:16:34: error: expression list treated as compound expression in initializer [-fpermissive]
   16 | bool checkcol2(ll a, ll b, ll col){
      |                                  ^
soccer.cpp:22:28: error: 'std::vector' has not been declared
   22 | int biggest_stadium(int N, std::vector<std::vector<int>> F)
      |                            ^~~
soccer.cpp:22:39: error: expected ',' or '...' before '<' token
   22 | int biggest_stadium(int N, std::vector<std::vector<int>> F)
      |                                       ^
soccer.cpp: In function 'int biggest_stadium(int, int)':
soccer.cpp:24:5: error: 'll' was not declared in this scope
   24 |     ll ans = N*N;
      |     ^~
soccer.cpp:25:9: error: 'i' was not declared in this scope
   25 |     FOR(i,0,N){
      |         ^
soccer.cpp:25:5: error: 'FOR' was not declared in this scope
   25 |     FOR(i,0,N){
      |     ^~~
soccer.cpp:38:9: error: 'j' was not declared in this scope
   38 |     FOR(j,0,N){
      |         ^
soccer.cpp:45:5: error: 'vector' was not declared in this scope
   45 |     vector<vector<ll>> special;
      |     ^~~~~~
soccer.cpp:45:24: error: 'special' was not declared in this scope
   45 |     vector<vector<ll>> special;
      |                        ^~~~~~~
soccer.cpp:64:15: error: expected ';' before 'i'
   64 |             ll i = X[0], j = X[1], k = Y[0], l= Y[1];
      |               ^~
      |               ;
soccer.cpp:65:18: error: 'grid2' was not declared in this scope
   65 |              if (grid2[i][j]==1 || grid2[k][l] == 1) continue;
      |                  ^~~~~
soccer.cpp:65:42: error: 'k' was not declared in this scope
   65 |              if (grid2[i][j]==1 || grid2[k][l] == 1) continue;
      |                                          ^
soccer.cpp:65:45: error: 'l' was not declared in this scope
   65 |              if (grid2[i][j]==1 || grid2[k][l] == 1) continue;
      |                                             ^
soccer.cpp:66:38: error: 'l' was not declared in this scope
   66 |             bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l));
      |                                      ^
soccer.cpp:66:45: error: 'checkrow2' cannot be used as a function
   66 |             bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l));
      |                                             ^
soccer.cpp:66:60: error: 'k' was not declared in this scope
   66 |             bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l));
      |                                                            ^
soccer.cpp:66:67: error: 'checkcol2' cannot be used as a function
   66 |             bool check1 = (checkrow2(l, j, i) && checkcol2(k, i, l));
      |                                                                   ^
soccer.cpp:67:45: error: 'checkrow2' cannot be used as a function
   67 |             bool check2 = (checkrow2(l, j, k) && checkcol2(k, i, j));
      |                                             ^
soccer.cpp:67:67: error: 'checkcol2' cannot be used as a function
   67 |             bool check2 = (checkrow2(l, j, k) && checkcol2(k, i, j));
      |                                                                   ^
soccer.cpp:77:12: error: 'ans' was not declared in this scope
   77 |     return ans;
      |            ^~~