# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231042 | 2020-05-12T12:31:43 Z | jamielim | Red-blue table (IZhO19_stones) | C++14 | 10 ms | 1536 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int t; scanf("%d",&t); int n,m; char grid[1005][1005]; while(t--){ scanf("%d%d",&n,&m); int ans=0; int b=0; bool align=0; int halfh=ceil((double)(n)/(double)2); for(int i=0;i<=m;i++){ int a=0; int l=floor((double)(i*halfh)/(double)(n)),u=ceil((double)(i*halfh)/(double)(n)); if(2*(m-l)>=m&&2*(m-u)>=m)a=n; else if(2*(m-l)>=m)a=max(n/2,n-(i*halfh)%n); else a=n/2; if(i+a>ans){ ans=i+a; b=i; if(a==n/2)align=1; else align=0; } } printf("%d\n",ans); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ grid[i][j]='+'; } grid[i][m]='\0'; } if(align){ for(int i=0;i<b*halfh;i++){ grid[i%n][i/halfh]='-'; } }else{ for(int i=0;i<b;i++){ for(int j=0;j<halfh;j++)grid[j][i]='-'; } } for(int i=0;i<n;i++)printf("%s\n",grid[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 4 ms | 384 KB | in the table A+B is not equal to 6 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | in the table A+B is not equal to 46 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 4 ms | 384 KB | in the table A+B is not equal to 6 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 1536 KB | in the table A+B is not equal to 116 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 1536 KB | in the table A+B is not equal to 48 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 4 ms | 384 KB | in the table A+B is not equal to 6 |