#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define st first
#define nd second
#define pii pair<int,int>
#define N 200005
#define INF 1000000005
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(),(x).end()
#define ll long long
#define int ll
using namespace std;
int n,m,ans;
void solve(){
cin >> n >> m;
char table[n][m];
vector<int> cnt(n,0);
int ans;
if(n>=m){
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
table[i][j]='+';
}
}
ans=n;
int cur=0;
int l=n*(m-1)/(n+2);
for(int i=0;i<n;i++){
for(int j=0;j<(m-1)/2;j++){
table[i][cur]='-';
cnt[cur]++;
cur++;
cur%=l;
}
}
for(int i=0;i<l;i++){
if(cnt[i]>=n/2+1)
ans++;
}
}
else{
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
table[i][j]='-';
}
}
ans=m;
int cur=0;
int l=m*(n-1)/(m+2);
for(int i=0;i<m;i++){
for(int j=0;j<(n-1)/2;j++){
table[i][cur]='+';
cnt[cur]++;
cur++;
cur%=l;
}
}
for(int i=0;i<l;i++){
if(cnt[i]>=m/2+1)
ans++;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout << table[i][j];
}
cout << endl;
}
}
int32_t main(){
fastio()
int t=1;
cin >> t;
while(t--)
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
57 ms |
1388 KB |
Expected integer, but "-----------+++++++++++++" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Expected integer, but "---" found |
2 |
Halted |
0 ms |
0 KB |
- |