Submission #475093

#TimeUsernameProblemLanguageResultExecution timeMemory
475093aintaNavigation 2 (JOI21_navigation2)C++17
0 / 100
1 ms320 KiB
#include "Anna.h" #include <bits/stdc++.h> using namespace std; #define vc vector #define vi vector<int> #define si(x) ((int)x.size()) #define pb push_back #define fi first #define se second using pii = pair<int,int>; static int chk[3][3], OO[3][3]; static void Paint(vc<pii> A){ auto [ax,ay] = A[0]; auto [bx,by] = A[1]; for(int i=0;i<3;i++)for(int j=0;j<3;j++)OO[i][j]=0; OO[ax][ay] = OO[bx][by] = -1; int c = 0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ int x = (ax + i)%3, y = (ay + j)%3; if(OO[x][y] != -1){ OO[x][y] = c++; } } } } static void rearrange(vc<pii> &V){ if(V[0] > V[1])swap(V[0],V[1]); if(V[0].fi == V[1].se){ if(V[0].fi==0 && V[1].se==2)swap(V[1],V[0]); } else if(V[0].fi==0 && V[1].se==2)swap(V[1],V[0]); } void Anna(int N, int K, std::vector<int> R, std::vector<int> C) { for(int i=0;i<7;i++){ chk[R[i]%3][C[i]%3]=1; } vc<pii>V; vc<pii>U; int NN[7]; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(!chk[i][j] && si(V) < 2){ V.pb({i,j}); } } } rearrange(V); Paint(V); for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ if(OO[i%3][j%3] != -1){ int a = OO[i%3][j%3]; if(i - R[a] > 1){ SetFlag(i,j,4); } else if(i - R[a] < -1){ SetFlag(i,j,3); } else if(j - C[a] > 1){ SetFlag(i,j,2); } else if(j - C[a] < -1){ SetFlag(i,j,1); } else{ SetFlag(i, j, 5 + OO[R[a]%3][C[a]%3]); } } else{ SetFlag(i, j, 12); } } } }
#include "Bruno.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int,int>; #define vc vector #define vi vector<int> #define si(x) ((int)x.size()) #define pb push_back #define fi first #define se second static int chk[3][3], OO[3][3]; static void Paint(vc<pii> A){ auto [ax,ay] = A[0]; auto [bx,by] = A[1]; for(int i=0;i<3;i++)for(int j=0;j<3;j++)OO[i][j]=0; OO[ax][ay] = OO[bx][by] = -1; int c = 0; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ int x = (ax + i)%3, y = (ay + j)%3; if(OO[x][y] != -1){ OO[x][y] = c++; } } } } static void rearrange(vc<pii> &V){ if(V[0] > V[1])swap(V[0],V[1]); if(V[0].fi == V[1].se){ if(V[0].fi==0 && V[1].se==2)swap(V[1],V[0]); } else if(V[0].fi==0 && V[1].se==2)swap(V[1],V[0]); } std::vector<int> Bruno(int K, std::vector<int> value) { vc<pii>V; for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ if(value[i*3+j] == 12){ V.pb({i,j}); } } } rearrange(V); Paint(V); vi R(7); for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ //printf("%d %d %d\n",i,j,OO[i][j]); int a = value[i*3+j]; if(OO[i][j]!=-1){ if(a<=4){ R[OO[i][j]] = a-1; } else{ a-=5; int xx, yy; for(int k=i-1;k<=i+1;k++){ for(int l=j-1;l<=j+1;l++){ if(OO[k%3][l%3] == a){ xx=k, yy=l; } } } int t = 4; if(1 > xx)t = 3; else if(1 < xx)t = 2; else if(1 > yy)t = 1; else if(1 < yy)t = 0; //printf("%d %d %d %d %d\n",a,i,j,xx,yy); R[OO[i][j]] = t; } } } } return R; }

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:45:9: warning: unused variable 'NN' [-Wunused-variable]
   45 |     int NN[7];
      |         ^~

Bruno.cpp:13:12: warning: 'chk' defined but not used [-Wunused-variable]
   13 | static int chk[3][3], OO[3][3];
      |            ^~~
Bruno.cpp: In function 'std::vector<int> Bruno(int, std::vector<int>)':
Bruno.cpp:72:26: warning: 'yy' may be used uninitialized in this function [-Wmaybe-uninitialized]
   72 |                     else if(1 < yy)t = 0;
      |                          ^~
Bruno.cpp:70:26: warning: 'xx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   70 |                     else if(1 < xx)t = 2;
      |                          ^~
#Verdict Execution timeMemoryGrader output
Fetching results...