이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int conv(int i) {
if (i%2 == 0) {
return (i-2);
}
else {
return i-1;
}
}
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int T;
cin >> T;
while (T-->0) {
int N, M;
cin >> N >> M;
char board[N][M];
if (max(N, M) >= conv(N)+conv(M)) {
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
board[i][j] = (N >= M ? '+' : '-');
}
}
}
else {
for (int i = conv(N); i < N; i++) {
for (int j = 0; j < M; j++) {
board[i][j] = '-';
}
}
for (int j = conv(M); j < M; j++) {
for (int i = 0; i < N; i++) {
board[i][j] = '+';
}
}
for (int i = 0; i < conv(N); i++) {
for (int j = 0; j < conv(M); j++) {
board[i][j] = ((i + j)%2 ? '+' : '-');
}
}
}
cout << max(max(N, M), conv(N) + conv(M)) << '\n';
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
cout << board[i][j];
}
cout << '\n';
}
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |