#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
#define OK puts("OK");
#define sz(s) (int)s.size()
#define pii pair<int,int>
#define all(s) s.begin(), s.end()
#define allr(s) s.rbegin(), s.rend()
#define rep(i,n) for (i=0;i<(n);++i)
#define rep1(i,n) for (i=1;i<=(n);++i)
#define ret return
#define nemeshay ios::sync_with_stdio(0),cin.tie(0);
const int N=1e6+12,INF=1e9+7;
int q[1001][1001];
main(){
int t;
cin>>t;
while (t--){
int n,m,i,j;
cin>>n>>m;
if (m>n){
n--;
cout <<m+n/2<<"\n";
for (i=0;i<n/2;++i)
for (j=0;j<m;++j)
q[i][j]=1;
n++;
}
else {
for (i=0;i<n;++i)
for (j=0;j<m;++j)
q[i][j]=1;
m--;
cout <<n+m/2<<"\n";
for (i=0;i<n;++i)
for (j=0;j<m/2;++j)
q[i][j]=0;
m++;
}
for (i=0;i<n;++i){
for (j=0;j<m;++j){
if (q[i][j])cout <<'+';
else cout <<'-';
}
cout <<"\n";
}
for (i=0;i<n;++i){
for (j=0;j<m;++j){
q[i][j]=0;
}
}
}
}
Compilation message
stones.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main(){
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
504 KB |
Output is correct |
4 |
Incorrect |
6 ms |
632 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
1760 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
1912 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
4 ms |
504 KB |
Output is correct |
4 |
Incorrect |
6 ms |
632 KB |
Wrong answer in test 5 29: 31 < 32 |