Submission #673219

#TimeUsernameProblemLanguageResultExecution timeMemory
673219dooompyNavigation 2 (JOI21_navigation2)C++17
Compilation error
0 ms0 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; int cur[105][105]; bool seen[15]; int n; void Anna(int N, int K, vector<int> R, vector<int> C) { n = N; bool valid = true; for (int offset = 0; offset < 9; offset++) { valid = true; for (int i = 0; i < N; i++) { if (!valid) break; for (int j = 0; j < N; j++) { if (!valid) break; int dx = offset / 3; int dy = offset % 3; int nx = i + dx, ny = j + dy; int equival = ((nx) % 3) * 3 + (ny) % 3; if (equival == 8) { // anchor point cur[i][j] = 1e9; } else if (equival == 7) { // store val for later cur[i][j] = -1; } else { int ndx = - R[equival] + i, ndy = - C[equival] + j; if (ndx >= 2) { cur[i][j] = 12; } else if (ndy >= 2) { cur[i][j] = 10; } else if (ndx <= -2) { cur[i][j] = 11; } else if (ndy <= -2) { cur[i][j] = 9; } else { cur[i][j] = (ndx + 1) * 3 + ndy + 2; if (cur[i][j] == 9) { valid = false; break; } // if (cur[i][j] > 5) cur[i][j]--; } } // cout << cur[i][j] << " " ; } } if (valid) break;
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; vector<int> Bruno(int K, vector<int> value) { // cout << "Called " << endl; int anchor = 0; int dx, dy; for (int i = 0; i < 9; i++) { if (value[i] == 12) { anchor = i; dx = i / 3, dy = i % 3; } } // for (int i =0 ; i < 9; i++) cout << value[i] << " "; // cout << endl; int skipped = value[dx * 3 + ((dy + 2) % 3)]; // cout << skipped << endl; // cout << value[7] << " " << value[8] << endl; vector<int> ans(K, 0); for (int i = 0; i < 9; i++) { if (value[i] == skipped || value[i] == 12) continue; int ni = (i / 3 + 2 - dx) % 3, nj = (i % 3 + 2 - dy) % 3; int equival = (ni * 3 + nj); // cout << "equiv " << equival << endl; // if (equival >= 8) assert(false); if (value[i] >= skipped) value[i]++; if (equival >= 7) continue; if (value[i] >= 9) ans[equival] = value[i] - 9; else { int r = (i / 3) + (1 - (value[i]- 1) / 3); int c = (i % 3) + (1 - (value[i]- 1) % 3); if (1 == r && 1 == c) ans[equival] = 4; else if (r < 1) ans[equival] = 3; else if (c < 1) ans[equival] = 1; else if (r > 1) ans[equival] = 2; else if (c > 1) ans[equival] = 0; } } return ans; // cout << endl; // return vector<int>(K, 0); // assert(false); }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:62: note: '-Wmisleading-indentation' is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
   62 | 
      | 
Anna.cpp:61:29: error: expected '}' at end of input
   61 |             if (valid) break;
      |                             ^
Anna.cpp:14:52: note: to match this '{'
   14 |         for (int offset = 0; offset < 9; offset++) {
      |                                                    ^
Anna.cpp:61:29: error: expected '}' at end of input
   61 |             if (valid) break;
      |                             ^
Anna.cpp:10:59: note: to match this '{'
   10 |     void Anna(int N, int K, vector<int> R, vector<int> C) {
      |                                                           ^

Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:8:13: warning: variable 'anchor' set but not used [-Wunused-but-set-variable]
    8 |         int anchor = 0;
      |             ^~~~~~
Bruno.cpp:30:60: warning: 'dy' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |             int ni = (i / 3 + 2 - dx) % 3, nj = (i % 3 + 2 - dy) % 3;
      |                                                 ~~~~~~~~~~~^~~~~
Bruno.cpp:30:33: warning: 'dx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |             int ni = (i / 3 + 2 - dx) % 3, nj = (i % 3 + 2 - dy) % 3;
      |                      ~~~~~~~~~~~^~~~~