# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203012 | 2020-02-19T02:48:09 Z | luciocf | Red-blue table (IZhO19_stones) | C++14 | 71 ms | 2404 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; const int maxn = 1e3+10; pii linha[maxn]; char tab[maxn][maxn]; int main(void) { int t; scanf("%d", &t); while (t--) { int n, m; scanf("%d %d", &n, &m); int mx = n, opt = 0; for (int B = 0; B <= m; B++) { int need = (m+2)/2 - (m-B); int qtd = B; if (need == 0) qtd += n; else { int x = (n - ((n+2)/2))*B; qtd += min(n, x/need); } if (qtd > mx) mx = qtd, opt = B; } for (int i = 1; i <= n; i++) linha[i] = {0, i}; printf("%d\n", mx); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) tab[i][j] = '-'; for (int i = 1; i <= n; i++) for (int j = 1; j <= m-opt; j++) tab[i][j] = '+'; for (int j = m-opt+1; j <= m; j++) { sort(linha+1, linha+mx-opt+1); for (int k = 1; k <= n - ((n+2)/2); k++) { tab[linha[k].second][j] = '+'; linha[k].first++; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) printf("%c", tab[i][j]); printf("\n"); } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 380 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
4 | Correct | 8 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 68 ms | 1528 KB | Output is correct |
2 | Correct | 71 ms | 2040 KB | Output is correct |
3 | Correct | 59 ms | 2168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 70 ms | 1528 KB | Output is correct |
2 | Correct | 62 ms | 1960 KB | Output is correct |
3 | Correct | 53 ms | 1656 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 380 KB | Output is correct |
3 | Correct | 6 ms | 376 KB | Output is correct |
4 | Correct | 8 ms | 376 KB | Output is correct |
5 | Correct | 68 ms | 1528 KB | Output is correct |
6 | Correct | 71 ms | 2040 KB | Output is correct |
7 | Correct | 59 ms | 2168 KB | Output is correct |
8 | Correct | 70 ms | 1528 KB | Output is correct |
9 | Correct | 62 ms | 1960 KB | Output is correct |
10 | Correct | 53 ms | 1656 KB | Output is correct |
11 | Correct | 19 ms | 632 KB | Output is correct |
12 | Correct | 60 ms | 1912 KB | Output is correct |
13 | Correct | 58 ms | 2040 KB | Output is correct |
14 | Correct | 41 ms | 1660 KB | Output is correct |
15 | Correct | 70 ms | 2404 KB | Output is correct |
16 | Correct | 56 ms | 2012 KB | Output is correct |
17 | Correct | 25 ms | 1272 KB | Output is correct |