# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
286210 | 2020-08-30T08:25:10 Z | SomeoneUnknown | Red-blue table (IZhO19_stones) | C++14 | 9 ms | 2304 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int T; scanf("%d", &T); for(int t = 0; t < T; ++t){ int r, c; scanf("%d %d", &r, &c); /*if(r == 2 && c == 1){ printf("2\n+\n+\n"); continue; }//*/ char ans[r][c+1]; for(int i = 0; i < r; ++i){ ans[i][c] = '\0'; } if(r > c){ for(int i = 0; i < r; ++i){ for(int j = 0; j < c; ++j){ ans[i][j] = '+'; } } long long bestaddi = (long long) r * (((long long) c - 1) / 2) / (((long long) r) / 2 + 1); long long cur = 0; for(int i = 0; i < r; ++i){ for(int j = 0; j < (c - 1) / 2; ++j){ ans[i][cur] = '-'; cur++; cur %= bestaddi; } } printf("%lld\n", r+bestaddi); for(int i = 0; i < r; ++i){ printf("%s\n", ans[i]); } }else{ for(int i = 0; i < r; ++i){ for(int j = 0; j < c; ++j){ ans[i][j] = '-'; } } long long bestaddi = (long long) c * (((long long) r - 1) / 2) / (((long long) c) / 2 + 1); long long cur = 0; for(int i = 0; i < c; ++i){ for(int j = 0; j < (r - 1) / 2; ++j){ ans[cur][i] = '+'; cur++; cur %= bestaddi; } } printf("%lld\n", c+bestaddi); for(int i = 0; i < r; ++i){ printf("%s\n", ans[i]); } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 372 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 372 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 1408 KB | Output is correct |
2 | Correct | 6 ms | 1920 KB | Output is correct |
3 | Correct | 6 ms | 1920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 1280 KB | Output is correct |
2 | Correct | 6 ms | 1664 KB | Output is correct |
3 | Correct | 5 ms | 1408 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 372 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 1408 KB | Output is correct |
6 | Correct | 6 ms | 1920 KB | Output is correct |
7 | Correct | 6 ms | 1920 KB | Output is correct |
8 | Correct | 7 ms | 1280 KB | Output is correct |
9 | Correct | 6 ms | 1664 KB | Output is correct |
10 | Correct | 5 ms | 1408 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 5 ms | 1536 KB | Output is correct |
13 | Correct | 5 ms | 1408 KB | Output is correct |
14 | Correct | 4 ms | 1152 KB | Output is correct |
15 | Correct | 7 ms | 2304 KB | Output is correct |
16 | Correct | 6 ms | 1784 KB | Output is correct |
17 | Correct | 3 ms | 1024 KB | Output is correct |