# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
422190 | errorgorn | Navigation 2 (JOI21_navigation2) | C++17 | 1 ms | 320 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
int n,k;
int grid[105][105];
const ii coord[]={{-1,-1},{-1,0},{-1,1},
{0,-1},{0,0},{0,1},
{1,-1},{1,0},{1,1}};
} // namespace
void Anna(int N, int K, std::vector<int> R, std::vector<int> C) {
n=N,k=K;
memset(grid,0,sizeof(grid));
rep(x,0,n) rep(y,0,n){
int num=(x%3)*3+(y%3);
if (num==0) grid[x][y]=14;
else if (num==8) grid[x][y]=1;
else{
num--;
rep(z,0,9) if (x==R[num]+coord[z].fi && y==C[num]+coord[z].se){
grid[x][y]=z+1;
}
if (grid[x][y]==0){
if (C[num]<y-1) grid[x][y]=10;
else if (y+1<C[num]) grid[x][y]=11;
else if (R[num]<x-1) grid[x][y]=12;
else if (x+1<R[num]) grid[x][y]=13;
}
}
}
/*
rep(x,0,n){
rep(y,0,n) cout<<grid[x][y]<<" "; cout<<endl;
}
//*/
rep(x,0,n) rep(y,0,n) SetFlag(x,y,grid[x][y]);
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
namespace {
int k;
const ii coord[]={{-1,-1},{-1,0},{-1,1},
{0,-1},{0,0},{0,1},
{1,-1},{1,0},{1,1}};
} // namespace
std::vector<int> Bruno(int K, std::vector<int> value) {
k=K;
int px,py;
rep(x,0,9) if (value[x]==14){
px=x/3,py=x%3;
}
vector<int> ans;
rep(x,0,k){
int dx=(px+(x+1)/3)%3;
int dy=(py+(x+1))%3;
int i=dx*3+dy;
if (value[i]<=9){
int ddx=(dx-1)-coord[value[i]-1].fi;
int ddy=(dy-1)-coord[value[i]-1].se;
//cout<<x<<" "<<ddx<<" "<<ddy<<endl;
if (ddy>0) ans.pub(0);
else if (ddy<0) ans.pub(1);
else if (ddx>0) ans.pub(2);
else if (ddx<0) ans.pub(3);
else ans.pub(4);
}
else if (value[i]==10) ans.pub(1);
else if (value[i]==11) ans.pub(0);
else if (value[i]==12) ans.pub(3);
else if (value[i]==13) ans.pub(2);
}
for (auto &it:ans) cout<<it<<" "; cout<<endl;
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |