#include <bits/stdc++.h>
#define pb push_back
#define ALL(x) x.begin(),x.end()
using namespace std;
int n, m;
string s = "+-";
const int N = 1e3+1;
char ans[N][N];
void go() {
bool flip = 0;
cin >> n >> m;
if (n > m) {
flip = 1;
swap(n, m);
reverse(ALL(s));
}
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) ans[i][j] = s[1];
int changeCnt = m * ((n-1)/2), curLine = 0, curPick = 0;
for (int i = 0; changeCnt>0; i++) {
ans[curLine][i%m] = s[0];
changeCnt--, curPick++;
if (curPick*2 > m) {
curLine++;
curPick = 0;
}
}
if (flip) swap(n, m);
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) cout << (flip ? ans[j][i] : ans[i][j]);
cout << '\n';
}
}
signed main() {
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
int T; cin >> T;
while(T--) go();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Expected integer, but "+++++++++++++++++++++++----------------------" found |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
1372 KB |
Expected integer, but "--+-+-+-+-+-+-+-+-+++" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
46 ms |
1356 KB |
Expected integer, but "+++++++++++++-----------" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |