# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162853 | 2019-11-10T06:34:15 Z | abacaba | Red-blue table (IZhO19_stones) | C++14 | 24 ms | 2040 KB |
#include <chrono> #include <random> #include <iostream> #include <string> #include <unordered_map> #include <cstring> #include <vector> #include <map> #include <set> #include <algorithm> #include <math.h> #include <cstdio> #include <stdio.h> #include <queue> #include <bitset> #include <cstdlib> #include <deque> #include <cassert> #include <stack> using namespace std; const int mod = 1e9 + 7; const int inf = 1e9; const int N = 1e3 + 15; int t, n, m, a[N][N]; int red_in_row[N], red_in_col[N]; inline void paint_odd() { for(int i = 2; i < n; i += 2) for(int j = 2; j <= m; j += 2) if(2 * (red_in_col[j] + 1) < n) a[i][j] = 1, ++red_in_row[i], ++red_in_col[j]; for(int j = 1; j <= m; ++j) for(int i = 1; i <= n; ++i) if(red_in_row[i] * 2 <= m && (red_in_row[i] + 1) * 2 > m && !a[i][j]) a[i][j] = 1, ++red_in_row[i], ++red_in_col[j]; } inline void paint_even() { for(int i = 1; i < (n + 1) / 2; ++i) for(int j = 1; j <= m / 2 + 1; ++j) a[i][j] = 1, ++red_in_row[i], ++red_in_col[j]; for(int i = n; i > (n + 1) / 2; --i) for(int j = m; j >= m / 2 + 1; --j) a[i][j] = 1, ++red_in_row[i], ++red_in_col[j]; } main() { scanf("%d", &t); while(t--) { int ans = 0; for(int i = 1; i <= n; ++i) { red_in_row[i] = 0; for(int j = 1; j <= m; ++j) a[i][j] = red_in_col[j] = 0; } scanf("%d %d", &n, &m); paint_even(); for(int i = 1; i <= n; ++i) ans += (2 * red_in_row[i] > m); for(int j = 1; j <= m; ++j) ans += (2 * red_in_col[j] < n); printf("%d\n", ans); for(int i = 1; i <= n; ++i, puts("")) for(int j = 1; j <= m; ++j) putchar(a[i][j] == 1 ? '+' : '-'); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Wrong answer in test 2 1: 1 < 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 504 KB | Wrong answer in test 2 1: 1 < 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Wrong answer in test 2 1: 1 < 2 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 1744 KB | Wrong answer in test 87 1: 86 < 87 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2040 KB | Wrong answer in test 24 24: 23 < 44 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Wrong answer in test 2 1: 1 < 2 |