# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1010118 | Unforgettablepl | Navigation 2 (JOI21_navigation2) | C++17 | 577 ms | 1704 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Anna.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
vector<vector<int>> assignment = {
{0,1,2},
{3,4,5},
{6,7,7},
};
} // namespace
void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
for (int r = 0; r < N; r++) {
for (int c = 0; c < N; c++) {
if(assignment[r%3][c%3]==7){SetFlag(r,c,14);continue;}
auto ass = assignment[r%3][c%3];
if(abs(R[ass]-r)<=1 and abs(C[ass]-c)<=1){
if(R[ass]==r and C[ass]==c)SetFlag(r,c,13);
else if(R[ass]==r-1 and C[ass]==c)SetFlag(r,c,12);
else if(R[ass]==r-1 and C[ass]==c-1)SetFlag(r,c,11);
else if(R[ass]==r-1 and C[ass]==c+1)SetFlag(r,c,5);
else if(R[ass]==r and C[ass]==c-1)SetFlag(r,c,10);
else if(R[ass]==r and C[ass]==c+1)SetFlag(r,c,6);
else if(R[ass]==r+1 and C[ass]==c-1)SetFlag(r,c,9);
else if(R[ass]==r+1 and C[ass]==c)SetFlag(r,c,8);
else if(R[ass]==r+1 and C[ass]==c+1)SetFlag(r,c,7);
continue;
}
if(abs(R[ass]-r)<=1){
if(c<C[ass])SetFlag(r,c,2);
else if(C[ass]<c)SetFlag(r,c,4);
continue;
}
if(r<R[ass])SetFlag(r,c,3);
else if(R[ass]<r)SetFlag(r,c,1);
}
}
}
#include "Bruno.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
namespace {
vector<pair<int,int>> idxlookup = {
{0,0},
{0,1},
{0,2},
{1,0},
{1,1},
{1,2},
{2,0},
};
} // namespace
std::vector<int> Bruno(int K, std::vector<int> value) {
vector<vector<int>> val = {
{value[0],value[1],value[2]},
{value[3],value[4],value[5]},
{value[6],value[7],value[8]},
};
vector<int> ans(K, 0);
int rowoffset = 0;
if(val[0][0]==14 or val[0][1]==14 or val[0][2]==14)rowoffset=1;
if(val[1][0]==14 or val[1][1]==14 or val[1][2]==14)rowoffset=2;
if(val[2][0]==14 or val[2][1]==14 or val[2][2]==14)rowoffset=0;
int coloffset = 0;
if(val[(rowoffset+2)%3][1]==14 and val[(rowoffset+2)%3][2]==14)coloffset=0;
if(val[(rowoffset+2)%3][0]==14 and val[(rowoffset+2)%3][1]==14)coloffset=2;
if(val[(rowoffset+2)%3][0]==14 and val[(rowoffset+2)%3][2]==14)coloffset=1;
for(int i=0;i<K;i++){
int act_x = (idxlookup[i].first+rowoffset)%3;
int act_y = (idxlookup[i].second+coloffset)%3;
if(val[act_x][act_y]==1){ans[i]=3;continue;}
if(val[act_x][act_y]==2){ans[i]=0;continue;}
if(val[act_x][act_y]==3){ans[i]=2;continue;}
if(val[act_x][act_y]==4){ans[i]=1;continue;}
int where_x = act_x;
int where_y = act_y;
if(val[act_x][act_y]==13){where_x+=0;where_y+=0;}
if(val[act_x][act_y]==12){where_x+=-1;where_y+=0;}
if(val[act_x][act_y]==11){where_x+=-1;where_y+=-1;}
if(val[act_x][act_y]==10){where_x+=0;where_y+=-1;}
if(val[act_x][act_y]==6){where_x+=0;where_y+=1;}
if(val[act_x][act_y]==5){where_x+=-1;where_y+=1;}
if(val[act_x][act_y]==9){where_x+=1;where_y+=-1;}
if(val[act_x][act_y]==8){where_x+=1;where_y+=0;}
if(val[act_x][act_y]==7){where_x+=1;where_y+=1;}
if(where_x==1 and where_y==1){ans[i]=4;continue;}
if(where_x<1){ans[i]=3;continue;}
if(where_x>1){ans[i]=2;continue;}
if(where_y<1){ans[i]=1;continue;}
if(where_y>1){ans[i]=0;continue;}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |