#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t-- > 0){
int n, m;
cin >> n >> m;
if (n == 1){
cout << m << '\n';
for (int i = 0; i < m; i++){
cout << "-";
}
cout << '\n';
continue;
}
if (n % 2 == 1 && m % 2 && n <= m){
cout << m + n / 2 << '\n';
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (i % 2 == 0){
cout << "-";
}else{
cout << "+";
}
}
cout << '\n';
}
cout << '\n';
continue;
}
if (m % 2 == 1 && n % 2 && m <= n){
cout << n + m / 2 << '\n';
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (j % 2 == 0)cout << "+";
else cout << "-";
}
cout << '\n';
}
cout << '\n';
continue;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
1372 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
15 ms |
888 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
376 KB |
Wrong answer |