# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168295 | 2019-12-12T10:04:29 Z | spartan_enkh | Red-blue table (IZhO19_stones) | C++14 | 39 ms | 1364 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int t,n,m,x,y,i,j,k,l; scanf("%d",&t); while(t--){ scanf("%d%d",&n,&m); if(n==1 || m==1){ printf("%d\n",max(n,m)); for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ if(m==1) printf("+"); else if(n==1) printf("-"); } printf("\n"); } } else if(n==2 || m==2){ printf("%d\n",max(n,m)); for(i=1;i<=n;i++){ for(j=1;j<=m;j++){ if(m==2) printf("+"); else if(n==2) printf("-"); } printf("\n"); } } else if(n<5 && m<5){ printf("%d\n",max(n,m)+1); if(n>=m){ for(i=1;i<=n;i++){ for(j=1;j<m;j++) printf("+"); printf("-\n"); } } else{ for(i=1;i<n;i++){ for(j=1;j<=m;j++) printf("-"); printf("\n"); } for(j=1;j<=m;j++) printf("+"); printf("\n"); } } else if(m<5){ printf("%d\n",n+1); for(i=1;i<=n;i++){ for(j=1;j<m;j++) printf("+"); printf("-\n"); } } else if(n<5){ printf("%d\n",m+1); for(i=1;i<n;i++){ for(j=1;j<=m;j++) printf("-"); printf("\n"); } for(j=1;j<=m;j++) printf("+"); printf("\n"); } else{ if(!(n%2)) x=n-2; else x=n-1; if(!(m%2)) y=m-2; else y=m-1; printf("%d\n",x+y); k=1; for(i=1;i<=x;i++){ if(k) l=1; else l=0; k=1-k; for(j=1;j<=y;j++){ if(l) printf("+"); else printf("-"); l=1-l; } if(!(m%2)) printf("++\n"); else printf("+\n"); } if(!(n%2)) k=2; else k=1; for(i=1;i<=k;i++){ for(j=1;j<=m;j++) printf("-"); printf("\n"); } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Wrong answer in test 38 5: 40 < 41 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 1364 KB | Output is correct |
2 | Correct | 34 ms | 1272 KB | Output is correct |
3 | Correct | 33 ms | 1144 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 38 ms | 1272 KB | Wrong answer in test 6 6: 8 < 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Incorrect | 4 ms | 376 KB | Wrong answer in test 38 5: 40 < 41 |