# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344063 | Nurlykhan | Red-blue table (IZhO19_stones) | C++17 | 45 ms | 1644 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1024;
int t;
int n, m;
char a[N][N];
void solve() {
// n and m odd
bool tmp = 0;
if (m > n) {
tmp = 1;
swap(n, m);
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if (j % 2) a[i][j] = 0;
else a[i][j] = 1;
}
}
if (tmp) {
printf("%d\n", n + m / 2);
for (int j = 0; j < m; j++) {
for (int i = 0; i < n; i++) {
if(a[i][j]) printf("-");
else printf("+");
}
printf("\n");
}
} else {
printf("%d\n", n + m / 2);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
if(!a[i][j]) printf("-");
else printf("+");
}
printf("\n");
}
}
}
int main() {
scanf("%d", &t);
while (t--) {
scanf("%d%d", &n, &m);
solve();
}
return 0;
}
Compilation message (stderr)
# | 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... |