Submission #5362

#TimeUsernameProblemLanguageResultExecution timeMemory
5362baneling100보도블록 (KOI11_block)C++98
0 / 22
0 ms1128 KiB
#include <stdio.h> int m, n, a[101][101], dy[4]={0,1,0,-1}, dx[4]={1,0,-1,0}; void input(void) { scanf("%d %d",&m,&n); } void process(void) { int z=0, y=1, x=1, ty, tx; printf("%d\n",2*m*n); while(a[y][x]==0) { a[y][x]=1; if((y+x)%2) { if(z==0 || z==3) printf("%d %d 0\n%d %d 1\n",y,x,y,x); else printf("%d %d 1\n%d %d 0\n",y,x,y,x); } else { if(z==0 || z==1) printf("%d %d 0\n%d %d 1\n",y,x,y,x); else printf("%d %d 1\n%d %d 0\n",y,x,y,x); } ty=y+dy[z]; tx=x+dx[z]; if(ty>=1 && ty<=m && tx>=1 && tx<=n && a[ty][tx]==0) { y=ty; x=tx; } else { z++; z%=4; ty=y+dy[z]; tx=x+dx[z]; y=ty; x=tx; } } } int main(void) { input(); process(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...