| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 40557 | vanjo9800 | Spirale (COCI18_spirale) | C++14 | 148 ms | 820 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<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... | ||||
