# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
855880 | 2023-10-02T06:28:59 Z | Halym2007 | Red-blue table (IZhO19_stones) | C++11 | 1 ms | 344 KB |
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 5; char jog[N][N]; int main () { freopen("input.txt", "r", stdin); int t; cin >> t; while ( t-- ) { int n, m, jogap = 0; cin >> n >> m; if (min(n, m) == 1) { char c; if (n == 1) c = '-'; else c = '+'; jogap = max (n, m); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { jog[i][j] = c; } } } else if (n >= m) { for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { jog[i][j] = '1'; } } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m / 2 + 1; ++j) { jog[i][j] = '+'; } } jogap = n + (m - (m / 2 + 1)); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (jog[i][j] == '1') jog[i][j] = '-'; } } } else { for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { jog[i][j] = '1'; } } for (int i = 1; i <= m; ++i) { for (int j = 1; j <= n / 2 + 1; ++j) { jog[j][i] = '-'; } } jogap = m + (n - (n / 2 + 1)); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (jog[i][j] == '1') jog[i][j] = '+'; } } } // int ans = 0; for (int i = 1; i <= n; ++i) { int r = 0; for (int j = 1; j <= m; ++j) { if (jog[i][j] == '+') { r++; } else r--; } if (r > 0) ans++; } for (int i = 1; i <= m; ++i) { int b = 0; for (int j = 1; j <= n; ++j) { if (jog[j][i] == '-') b++; else b--; } if (b > 0) ans++; } // // if (jogap != ans) { // cout << "input : " << ans << " " << n << " " << m << endl; // } cout << jogap << endl; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cout << jog[i][j]; } cout << endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |