# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480258 | 2021-10-15T12:03:10 Z | luka1234 | Red-blue table (IZhO19_stones) | C++14 | 2000 ms | 204 KB |
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; int main(){ 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++){ if((pos+p-1)<=yans){ for(int j=pos;j<=(pos+p-1);j++) a[i][j]='+'; pos=pos+p; } else{ int x1=yans-pos+1; int y2=p-x1; for(int j=pos;j<=yans;j++) a[i][j]='+'; for(int j=1;j<=(j+y2-1);j++) a[i][j]='+'; pos=1+y2; } } 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 | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2094 ms | 204 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Execution timed out | 2094 ms | 204 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2070 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2052 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Execution timed out | 2094 ms | 204 KB | Time limit exceeded |