# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
494861 | 2021-12-16T21:05:24 Z | Amer | Red-blue table (IZhO19_stones) | C++14 | 49 ms | 2292 KB |
#include <iostream> using namespace std; const int maxN = 1005; bool marked[maxN][maxN]; int num[maxN]; int solve(int n, int m) { int midN = n / 2 + 1; int midM = (m - 1) / 2; for (int i = 0; i <= n + 1; i++) { for (int j = 0; j <= n + 1; j++) { marked[i][j] = 0; } } for (int i = 0; i <= n + 1; i++) { num[i] = 0; } int sum = n; int pointer = 1; for (int i = 1; i <= m; i++) { int steps; bool full = false; for (steps = 1; steps <= midN; steps++) { if (num[pointer] >= midM) { full = true; break; } marked[i][pointer] = true; num[pointer]++; pointer++; if (pointer > n) { pointer = 1; } } if (steps >= midN + 1) { sum++; } if(full) { break; } } cout << sum << endl; return 0; } void test(int n, int m) { int sum = 0; if (n > m) { sum = solve(n, m); int place = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (marked[j][i]) { cout << "-"; } else { cout << "+"; } } cout << endl; } } else { sum = solve(m, n); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (marked[i][j]) { cout << "+"; } else { cout << "-"; } } cout << endl; } } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; for (int i = 0; i < t; i++) { int n, m; cin >> n >> m; test(n, m); } return 0; } /* 3 5 6 9 10 3 10 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 7 ms | 332 KB | Output is correct |
4 | Correct | 11 ms | 400 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 1356 KB | Output is correct |
2 | Correct | 21 ms | 1992 KB | Output is correct |
3 | Correct | 23 ms | 1992 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1344 KB | Output is correct |
2 | Correct | 24 ms | 1832 KB | Output is correct |
3 | Correct | 19 ms | 1584 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 7 ms | 332 KB | Output is correct |
4 | Correct | 11 ms | 400 KB | Output is correct |
5 | Correct | 49 ms | 1356 KB | Output is correct |
6 | Correct | 21 ms | 1992 KB | Output is correct |
7 | Correct | 23 ms | 1992 KB | Output is correct |
8 | Correct | 35 ms | 1344 KB | Output is correct |
9 | Correct | 24 ms | 1832 KB | Output is correct |
10 | Correct | 19 ms | 1584 KB | Output is correct |
11 | Correct | 24 ms | 592 KB | Output is correct |
12 | Correct | 23 ms | 1872 KB | Output is correct |
13 | Correct | 31 ms | 2028 KB | Output is correct |
14 | Correct | 17 ms | 1672 KB | Output is correct |
15 | Correct | 22 ms | 2292 KB | Output is correct |
16 | Correct | 17 ms | 1880 KB | Output is correct |
17 | Correct | 13 ms | 1272 KB | Output is correct |