#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ss second
#define ff first
#define pb push_back
#define pii pair<int, int>
#define INF INT_MAX
#define debug(n) cout << #n << " = " << n << "\n";
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const ll MOD = 1e9 + 7;
void solve() {
int n, m;
cin >> n >> m;
vector<vector<char> > res( n, vector<char>( m ) );
if(n > m) {
// more red (+)
for(int i = 0; i < n; i++) {
res[i][m - 1] = '+';
for(int j = 0; j + 1 < m - 1; j += 2) {
res[i][j] = '+';
res[i][j + 1] = '-';
}
}
cout << n + (m - 1) / 2 << "\n";
} else {
// more blue (-)
for(int i = 0; i < m; i++) {
res[n - 1][i] = '-';
for(int j = 0; j + 1 < n - 1; j+=2) {
res[j][i] = '-';
res[j + 1][i] = '+';
}
}
cout << m + (n - 1) / 2 << "\n";
}
for(auto line : res) {
for(char c : line) {
cout << c;
}
cout << "\n";
}
}
int main() {
FAST
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
invalid character |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
364 KB |
invalid character |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
invalid character |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
39 ms |
1388 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
36 ms |
1516 KB |
invalid character |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
invalid character |