#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pb push_back
#define int long long int
#define endl '\n'
#define MOD (int)(1e9 + 7)
#define all(x) x.begin(), x.end()
#define mid start+(end-start)/2
#define debug(x) cerr << #x << " = " << x << endl
#define binary(x) cerr << #x << " = " << bitset<8>(x) << endl
#define N (int)(1e3)+5
int t,n,m;
char mat[N][N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
cin >> t;
for(int i = 0; i < t; i++){
cin >> n >> m;
int na = n, ma = m;
if(ma >= na){
for(int j = 1; j <= ma; j++){
for(int k = 1; k <= na; k++){
if(k <= ((na+2)/2)) mat[j][k] = '-';
else mat[j][k] = '+';
}
}
}
else{
for(int j = 1; j <= na; j++){
for(int k = 1; k <= ma; k++){
if(k <= ((ma+1)/2)) mat[k][j] = '+';
else mat[k][j] = '-';
}
}
}
int ans = 0, atlar = 0, ekler = 0;
for(int j = 1; j <= n; j++){
for(int k = 1; k <= m; k++){
if(mat[k][j] == '+') atlar++;
else ekler++;
}
if(atlar > ekler) ans++;
atlar = 0, ekler = 0;
}
atlar = 0, ekler = 0;
for(int j = 1; j <= m; j++){
for(int k = 1; k <= n; k++){
if(mat[j][k] == '+') atlar++;
else ekler++;
}
if(ekler > atlar) ans++;
atlar = 0, ekler = 0;
}
cout << ans << endl;
for(int j = 1; j <= n; j++){
for(int k = 1; k <= m; k++){
cout << mat[k][j];
}
cout << endl;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 2: 1 < 4 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 20 2: 1 < 20 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 2: 1 < 4 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
1516 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
36 ms |
1516 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Wrong answer in test 4 2: 1 < 4 |