# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238847 | 2020-06-13T08:12:33 Z | arnold518 | Red-blue table (IZhO19_stones) | C++14 | 2000 ms | 1528 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 1000; int TC, N, M; char S[MAXN+10][MAXN+10]; int main() { int i, j, k; scanf("%d", &TC); while(TC--) { scanf("%d%d", &N, &M); int ans=0; pii t; for(i=0; i<=N; i++) { for(j=0; j<=M; j++) { int x=min((M-1)/2, j); int y=max(0, i-(N-1)/2); if(x*i>=y*j) { if(ans<=i+j) ans=i+j, t={i, j}; } } } for(i=0; i<N; i++) for(j=0; j<M; j++) S[i][j]='-'; int a=t.first, b=t.second; int x=min((M-1)/2, b); int y=max(0, a-(N-1)/2); for(j=0, i=0; j<b; j++) { for(k=0; k<y; k++, j=(j+1)%a) { S[i][j]='+'; } } printf("%d\n", ans); for(i=0; i<N; i++) { for(j=0; j<M; j++) printf("%c", S[i][j]); printf("\n"); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | in the table A+B is not equal to 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2091 ms | 384 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | in the table A+B is not equal to 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2087 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 1528 KB | in the table A+B is not equal to 44 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | in the table A+B is not equal to 2 |