Submission #1217582

#TimeUsernameProblemLanguageResultExecution timeMemory
1217582mychecksedadNavigation 2 (JOI21_navigation2)C++20
75 / 100
293 ms876 KiB
#include "Anna.h" #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' #define ff first #define ss second #define pii pair<int,int> #define vi vector<int> const int N = 3e6+100, M = 1e5+10, K = 52, MX = 30, FFF = 1e8+1; namespace { int FunctionExample(int r, int c, int K) { return (r + c) % K + 1; } } // namespace void Anna(int n, int k, std::vector<int> R, std::vector<int> C) { int arr[3][3] = { {0, 1, 2}, {3, 4, 5}, {6, 7, 8} }; // for(int i = 0; i < k; ++i) cerr << R[i] << ' ' << C[i] << '\n'; for(int i = 0; i < n; ++i){ for(int j = 0; j < n; ++j){ int pos = (i%3)*3 + (j%3); if(pos == 0){ SetFlag(i, j, 1); }else{ if(pos < 8){ --pos; int x_dif = R[pos] - i, y_dif = C[pos] - j; // cerr << i << ' ' << j << ' ' << x_dif << ' ' << y_dif << " wtf\n"; if(abs(x_dif) <= 1 && abs(y_dif) <= 1){ SetFlag(i, j, arr[x_dif + 1][y_dif + 1] + 2); }else{ if(abs(y_dif) >= abs(x_dif)){ if(y_dif > 0) SetFlag(i, j, 11); else SetFlag(i, j, 12); }else{ if(x_dif > 0) SetFlag(i, j, 13); else SetFlag(i, j, 14); } } }else{ SetFlag(i, j, 13); } } } } }
#include "Bruno.h" #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' #define ff first #define ss second #define pii pair<int,int> #define vi vector<int> const int N = 3e6+100, M = 1e5+10, K = 52, MX = 30, FFF = 1e8+1; namespace { int variable_example = 1; } // namespace std::vector<int> Bruno(int k, std::vector<int> value) { std::vector<int> res(k, 0); int x = 0, y = 0; vector<vector<int>> v(3, vi(3)); for(int i = 0; i < 3; ++i) for(int j =0 ; j < 3; ++j) v[i][j] = value[i*3 + j]; for(int i = 0; i < 3; ++i){ for(int j = 0; j < 3; ++j) if(v[i][j] == 1) x = i, y = j; } cerr << '\n'; cerr << '\n'; for(int i = 0; i < 3; ++i){ for(int j = 0; j < 3; ++j) cerr << v[i][j] << ' '; cerr << '\n';} cerr << '\n'; int arr[9][2] = { {-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 0}, {0, 1}, {1, -1}, {1, 0}, {1, 1} }; int cur = 0; for(int i = 0; i < 3; ++i){ for(int j = 0; j < 3; ++j){ if(i==0 && j==0) continue; int X = (x + i) % 3, Y = (y + j) % 3; if(cur == 8){ assert(v[X][Y] == 13); continue; } if(v[X][Y] <= 10){ int w = v[X][Y] - 2; int new_x = arr[w][0] + X, new_y = arr[w][1] + Y; int x_dif = new_x - 1, y_dif = new_y - 1; if(x_dif == 0 && y_dif == 0) res[cur] = 4; else if(y_dif > 0) res[cur] = 0; else if(y_dif < 0) res[cur] = 1; else if(x_dif > 0) res[cur] = 2; else res[cur] = 3; }else{ res[cur] = v[X][Y] - 11; } ++cur; } } // for(int i = 0; i < 7; ++i) cerr << res[i] << ' '; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...