Submission #4916

#TimeUsernameProblemLanguageResultExecution timeMemory
4916gs13068보도블록 (KOI11_block)C++98
13.20 / 22
0 ms1088 KiB
#include<cstdio> int main() { int i,j,n,m; scanf("%d%d",&n,&m); if(n&1) { if(m&1) { } else { printf("%d\n",2*n*m); for(i=1;i<=m;i++) { if(j&1)printf("1 %d 1\n1 %d 0\n",i,i); else printf("1 %d 0\n1 %d 1\n",i,i); } for(i=m;i>=1;i--) { if(i&1)for(j=m;j>=2;j--)printf("%d %d 1\n%d %d 0\n",j,i,j,i); else for(j=2;j<=m;j++) { if(j&1)printf("%d %d 1\n%d %d 0\n",j,i,j,i); else printf("%d %d 0\n%d %d 1\n",j,i,j,i); } } } } else { printf("%d\n",2*n*m); for(i=n;i>=1;i--)printf("%d 1 1\n%d 1 0\n",i,i); for(i=1;i<=n;i++) { if(i&1)for(j=2;j<=m;j++)printf("%d %d 0\n%d %d 1\n",i,j,i,j); else for(j=m;j>=2;j--) { if(j&1)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); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...