# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480269 | 2021-10-15T12:31:06 Z | luka1234 | Red-blue table (IZhO19_stones) | C++14 | 33 ms | 1524 KB |
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int t; cin>>t; while(t--){ int n,m; cin>>n>>m; int mx=-1; int xans,yans,p; char a[n+1][m+1]; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ int p1=max(((m/2+1)-m+j),0); int p2=n-(n/2+1); if(i*p1<=j*p2){ if((i+j)>mx){ mx=i+j; xans=i; yans=j; p=p1; } } } } if(mx<max(n,m)){ mx=max(n,m); cout<<mx<<"\n"; if(n>m) for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) cout<<'+'; cout<<"\n"; } else for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) cout<<'-'; cout<<"\n"; } continue; } cout<<mx<<"\n"; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) a[i][j]='-'; } for(int i=1;i<=xans;i++){ for(int j=yans+1;j<=m;j++) a[i][j]='+'; } int pos=1; for(int i=1;i<=xans;i++){ int v=min((pos+p-1),m); int v1=p-(v-pos+1); for(int j=pos;j<=v;j++) a[i][j]='+'; for(int j=1;j<=v1;j++) a[i][j]='+'; pos=v1+1; if(v1==0) pos=v+1; } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++) cout<<a[i][j]; cout<<"\n"; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 332 KB | in the table A+B is not equal to 28 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 2 ms | 332 KB | in the table A+B is not equal to 28 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 1224 KB | in the table A+B is not equal to 116 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 1228 KB | Output is correct |
2 | Correct | 30 ms | 1524 KB | Output is correct |
3 | Correct | 23 ms | 1332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 2 ms | 332 KB | in the table A+B is not equal to 28 |