#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve(){
int n, m;
cin >> n >> m;
bool swaped=false;
if(n<m){
swap(n, m);
swaped=true;
}
char a[n][m];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
a[i][j]='+';
}
}
int x = 0, ans=n, y=0;
for(int i=0; i<(m-1)/2; i++){
for(int j=0; j<m; j++){
a[j][y]='-';
x++;
if(x==(n/2)+1){
ans++;
y++;
x=0;
}
}
}
cout << ans << "\n";
if(!swaped){
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cout << a[i][j];
}
cout << "\n";
}
}
else{
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(a[j][i]=='+'){
cout << '-';
}
else{
cout << '+';
}
}
cout << "\n";
}
}
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
308 KB |
Wrong answer in test 3 45: 45 < 46 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
308 KB |
Wrong answer in test 3 45: 45 < 46 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
1304 KB |
in the table A+B is not equal to 101 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
1196 KB |
Output is correct |
2 |
Correct |
17 ms |
1588 KB |
Output is correct |
3 |
Correct |
16 ms |
1328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Incorrect |
1 ms |
308 KB |
Wrong answer in test 3 45: 45 < 46 |