Submission #12883

#TimeUsernameProblemLanguageResultExecution timeMemory
12883baneling100보도블록 (KOI11_block)C++98
22 / 22
4 ms1088 KiB
#include <stdio.h> int M, N; int main(void) { int i, j; scanf("%d %d",&M,&N); printf("%d\n",2*M*N); if(M%2) { if(N%2) { for(i=2 ; i<=N ; i++) { if(i%2) printf("1 %d 0\n1 %d 1\n",i,i); else printf("1 %d 0\n2 %d 0\n1 %d 1\n",i,i,i); } printf("2 %d 0\n2 %d 1\n3 %d 0\n3 %d 1\n3 %d 1\n2 %d 1\n3 %d 0\n",N,N,N,N,N-1,N-1,N-1); for(i=N-2 ; i>=2 ; i--) { if(i%2) printf("3 %d 1\n3 %d 0\n2 %d 1\n2 %d 0\n",i,i,i,i); else printf("2 %d 1\n3 %d 1\n3 %d 0\n",i,i,i); } for(i=4 ; i<=M ; i++) { if(i%2) for(j=N ; j>=2 ; j--) { if((i+j)%2) printf("%d %d 1\n%d %d 0\n",i,j,i,j); else printf("%d %d 0\n%d %d 1\n",i,j,i,j); } else for(j=2 ; j<=N ; j++) printf("%d %d 0\n%d %d 1\n",i,j,i,j); } for(i=M ; i>=1 ; i--) printf("%d 1 1\n%d 1 0\n",i,i); } else { for(i=1 ; i<=N ; i++) { if(i%2) for(j=2 ; j<=M ; j++) printf("%d %d 0\n%d %d 1\n",j,i,j,i); else for(j=M ; j>=2 ; j--) { if((i+j)%2) printf("%d %d 0\n%d %d 1\n",j,i,j,i); else printf("%d %d 1\n%d %d 0\n",j,i,j,i); } } for(i=N ; i>=1 ; i--) { if((i+1)%2) printf("1 %d 1\n1 %d 0\n",i,i); else printf("1 %d 0\n1 %d 1\n",i,i); } } } else { for(i=1 ; i<=M ; i++) { if(i%2) for(j=2 ; j<=N ; j++) printf("%d %d 0\n%d %d 1\n",i,j,i,j); else for(j=N ; j>=2 ; j--) { if((i+j)%2) printf("%d %d 1\n%d %d 0\n",i,j,i,j); else printf("%d %d 0\n%d %d 1\n",i,j,i,j); } } for(i=M ; i>=1 ; i--) printf("%d 1 1\n%d 1 0\n",i,i); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...