# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480267 | 2021-10-15T12:13:36 Z | luka1234 | Red-blue table (IZhO19_stones) | C++14 | 28 ms | 1604 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=0;i<=n;i++){ for(int j=0;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; } } } } 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 | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | in the table A+B is not equal to 28 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | in the table A+B is not equal to 28 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 28 ms | 1320 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 | 28 ms | 1336 KB | Output is correct |
2 | Correct | 21 ms | 1604 KB | Output is correct |
3 | Correct | 20 ms | 1292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | in the table A+B is not equal to 28 |