# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
480281 | 2021-10-15T12:59:37 Z | luka1234 | Red-blue table (IZhO19_stones) | C++14 | 34 ms | 2204 KB |
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; char a[1001][1001]; 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; 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),yans); 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 | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 3 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 1356 KB | Output is correct |
2 | Correct | 28 ms | 1904 KB | Output is correct |
3 | Correct | 24 ms | 2080 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 1440 KB | Output is correct |
2 | Correct | 21 ms | 1856 KB | Output is correct |
3 | Correct | 24 ms | 1556 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 3 ms | 332 KB | Output is correct |
5 | Correct | 34 ms | 1356 KB | Output is correct |
6 | Correct | 28 ms | 1904 KB | Output is correct |
7 | Correct | 24 ms | 2080 KB | Output is correct |
8 | Correct | 30 ms | 1440 KB | Output is correct |
9 | Correct | 21 ms | 1856 KB | Output is correct |
10 | Correct | 24 ms | 1556 KB | Output is correct |
11 | Correct | 7 ms | 532 KB | Output is correct |
12 | Correct | 19 ms | 1864 KB | Output is correct |
13 | Correct | 26 ms | 1964 KB | Output is correct |
14 | Correct | 15 ms | 1612 KB | Output is correct |
15 | Correct | 31 ms | 2204 KB | Output is correct |
16 | Correct | 32 ms | 1832 KB | Output is correct |
17 | Correct | 10 ms | 1220 KB | Output is correct |