# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40557 | vanjo9800 | Spirale (COCI18_spirale) | C++14 | 148 ms | 820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
using namespace std;
int field[201][201];
int main(){
cin.tie(NULL);
ios::sync_with_stdio(false);
int n,m,k;
cin>>n>>m>>k;
for(int i=0;i<k;i++){
int x,y,t,hor=1,ver=1,cntHor=1,cntVer=1,type=0;
cin>>x>>y>>t;
x+=n;
y+=m;
int cnt=1;
while(x>0&&y>0&&x<=3*n&&y<=3*m){
if(field[x][y]==0) field[x][y]=1<<30;
field[x][y]=min(field[x][y],cnt);
if(type==0){
x--;
cntVer--;
}
if(type==2){
x++;
cntVer--;
}
if(type==1){
if(t==0){
y++;
}else{
y--;
}
cntHor--;
}
if(type==3){
if(t==0){
y--;
}else{
y++;
}
cntHor--;
}
if(cntVer==0){
ver++;
cntVer=ver;
type++;
}
if(cntHor==0){
hor++;
cntHor=hor;
type++;
type%=4;
}
cnt++;
}
}
for(int i=n+1;i<=2*n;i++){
for(int j=m+1;j<=2*m;j++){
cout<<field[i][j]<<" ";
}
cout<<"\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |