// Muallif: Mansuraliyev Husanboy Murotali o'g'li >> NamPS
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const double PI=3.1415926535897932384626433832795;
// 0-9 >> 48-57; A-Z>>65-90 and a-z>>97-122 respectively;
int main()
{
ios;int t; cin>>t;while(t--){
map<int,int>row,col;
int n,m;
cin>>n>>m;
int mr=m/2+1,mc=(n-1)/2;
int mx=0;
string s[n];
for(int i=0;i<n;i++){
int mxx=mx;
for(int j=0;j<m;j++){
if(col[j]<mc){
if(row[i]<mr){
if(col[j]<mxx||mr-row[i]>=m-j){
s[i]+="+";col[j]++;row[i]++;
}else s[i]+="-";
}else{
s[i]+="-";
}
}else{
s[i]+="-";
}
mx=max(mx,col[j]);
}
}
int ans=0;
for(int i=0;i<n;i++){
if(row[i]>=mr) ans++;
}
for(int j=0;j<m;j++) if(col[j]>=mc) ans++;
cout<<ans<<"\n";
for(int i=0;i<n;i++) cout<<s[i]<<"\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
316 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Wrong answer in test 2 1: 1 < 2 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
332 KB |
Wrong answer in test 2 1: 1 < 2 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
316 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Wrong answer in test 2 1: 1 < 2 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
106 ms |
1288 KB |
Wrong answer in test 97 21: 112 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
122 ms |
1340 KB |
Output is correct |
2 |
Correct |
122 ms |
1784 KB |
Output is correct |
3 |
Correct |
129 ms |
1604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
316 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Wrong answer in test 2 1: 1 < 2 |