Submission #700252

#TimeUsernameProblemLanguageResultExecution timeMemory
700252minhcoolNavigation 2 (JOI21_navigation2)C++17
0 / 100
0 ms200 KiB
#include "Anna.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define fi first #define se second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 3e5 + 5; const int oo = 1e18 + 7, mod = 1e9 + 7; int n, a[N]; void Anna(int N, int K, vector<int> r, vector<int> c){ for(int ii = 0; ii < 3; ii++){ for(int jj = 0; jj < 3; jj++){ bool ck = 1; for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ int temp = (((i + ii) % 3) * 3 + ((j + jj) % 3)); if(temp == 8){ //SetFlag(i, j, 1); //mx = max(mx, 1); continue; } else if(temp == 7){ //mx = max(mx, 2); //SetFlag(i, j, 2); continue; } else{ //cout << i << " " << j << " " << r[temp] << " " << c[temp] << "\n"; int pos1 = r[temp], pos2 = c[temp]; int diff1 = r[temp] - i; int diff2 = c[temp] - j; ck &= (diff1 != 0 || diff2 != 0); } } } if(!ck) continue; for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ int temp = (((i + ii) % 3) * 3 + ((j + jj) % 3)); if(temp == 8){ //SetFlag(i, j, 1); continue; } else if(temp == 7){ SetFlag(i, j, 2); continue; } else{ //cout << i << " " << j << " " << r[temp] << " " << c[temp] << "\n"; int pos1 = r[temp], pos2 = c[temp]; int diff1 = r[temp] - i; int diff2 = c[temp] - j; if(diff1 <= -2) SetFlag(i, j, 5); else if(diff1 >= 2) SetFlag(i, j, 4); else if(diff2 <= -2) SetFlag(i, j, 3); else if(diff2 >= 2) SetFlag(i, j, 2); else{ int x = (diff1 + 1) * 3 + diff2 + 1; assert(x != 4); if(x <= 3) SetFlag(i, j, 6 + x); else SetFlag(i, j, 5 + x); } } } } return; } } } /* signed main(){ ios_base::sync_with_stdio(0); int t; cin >> t; while(t--) process(); }*/
#include "Bruno.h" #include<bits/stdc++.h> using namespace std; //#define int long long #define fi first #define se second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 3e5 + 5; const int oo = 1e18 + 7, mod = 1e9 + 7; int arr1[] = {-1, -1, -1, 0, 0, 1, 1, 1}; int arr2[] = {-1, 0, 1, -1, 1, -1, 0, 1}; vector<int> Bruno(int K, vector<int> values){ vector<int> dirs; dirs.resize(K); int pos = -1; //for(int i = 0; i < 9; i++) cout << values[i] << " "; //cout << "\n"; for(int i = 0; i < 9; i++){ if(values[i] == 1){ pos = i; break; } } int pos1 = (pos / 3) - 1, pos2 = (pos % 3) - 1; int posi = -1; for(int i = 1; i <= 3; i++){ for(int j = 1; j <= 3; j++){ int pos3 = pos1 + i, pos4 = pos2 + j; while(pos3 >= 2) pos3 -= 3; while(pos4 >= 2) pos4 -= 3; posi++; //cout << pos3 << " " << pos4 << " " << posi << "\n"; if(posi == 7) break; int x = values[(pos3 + 1) * 3 + pos4 + 1]; //cout << x << "\n"; if(x <= 5) dirs[posi] = x - 2; else{ int pos5 = pos3 + arr1[x - 6]; int pos6 = pos4 + arr2[x - 6]; //cout << posi << " " << pos5 << " " << pos6 << "\n"; if(pos6 > 0) dirs[posi] = 0; else if(pos6 < 0) dirs[posi] = 1; else if(pos5 > 0) dirs[posi] = 2; else if(pos5 < 0) dirs[posi] = 3; else dirs[posi] = 4; } } } return dirs; }

Compilation message (stderr)

Anna.cpp:17:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   17 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:40:11: warning: unused variable 'pos1' [-Wunused-variable]
   40 |       int pos1 = r[temp], pos2 = c[temp];
      |           ^~~~
Anna.cpp:40:27: warning: unused variable 'pos2' [-Wunused-variable]
   40 |       int pos1 = r[temp], pos2 = c[temp];
      |                           ^~~~
Anna.cpp:61:11: warning: unused variable 'pos1' [-Wunused-variable]
   61 |       int pos1 = r[temp], pos2 = c[temp];
      |           ^~~~
Anna.cpp:61:27: warning: unused variable 'pos2' [-Wunused-variable]
   61 |       int pos1 = r[temp], pos2 = c[temp];
      |                           ^~~~

Bruno.cpp:17:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   17 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...