Submission #40557

#TimeUsernameProblemLanguageResultExecution timeMemory
40557vanjo9800Spirale (COCI18_spirale)C++14
80 / 80
148 ms820 KiB
#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 timeMemoryGrader output
Fetching results...