# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
286166 | 2020-08-30T07:51:28 Z | SomeoneUnknown | Red-blue table (IZhO19_stones) | C++14 | 6 ms | 2048 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'; } for(int i = 0; i < (r-1)/2; ++i){ for(int j = 0; j < (c-1)/2; ++j){ ans[i][j] = '+'; //horizontal } } for(int i = r/2+1; i < r; ++i){ for(int j = 0; j < (c-1)/2; ++j){ ans[i][j] = '-'; //vertical } } for(int i = r/2+1; i < r; ++i){ for(int j = c/2+1; j < c; ++j){ ans[i][j] = '+'; //horizontal } } for(int i = 0; i < (r-1)/2; ++i){ for(int j = c/2+1; j < c; ++j){ ans[i][j] = '-'; //vertical } } for(int i = (r-1)/2; i <= r/2; ++i){ for(int j = 0; j < c; j++){ ans[i][j] = '-'; } } for(int j = 0; j < r; j++){ for(int i = (c-1)/2; i <= c/2; ++i){ ans[j][i] = '+'; } } int ansnum = r+c-4+(r%2)+(c%2); int ans2 = ansnum; if(2 - (r%2) > (c-1)/2){ for(int i = 0; i <= c/2; ++i){ for(int j = (r-1)/2; j <= r/2; ++j){ ans[j][i] = '+'; } } //printf("B"); ans2 = ansnum+2-(r%2)-(c-1)/2; } if(2 - (c%2) > (r-1)/2 && ansnum+2-(c%2)-(r-1)/2>ans2){ for(int i = 0; i <= r/2; ++i){ for(int j = (c-1)/2; j <= c/2; ++j){ ans[i][j] = '-'; } } for(int i = 0; i <= c/2; ++i){ for(int j = (r-1)/2; j <= r/2; ++j){ ans[j][i] = '-'; } } //printf("A"); ans2 = ansnum+2-(c%2)-(r-1)/2; } printf("%d\n", ans2); for(int i = 0; i < r; ++i){ printf("%s\n", ans[i]); } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Incorrect | 2 ms | 384 KB | Wrong answer in test 38 5: 40 < 41 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1408 KB | Output is correct |
2 | Correct | 3 ms | 2048 KB | Output is correct |
3 | Correct | 3 ms | 1920 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 1280 KB | Wrong answer in test 6 6: 8 < 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Incorrect | 2 ms | 384 KB | Wrong answer in test 38 5: 40 < 41 |