#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;
typedef vector <ll> vl;
typedef vector <int> vi;
typedef vector <bool> vb;
typedef vector <vector <int> > vvi;
typedef vector <vector <ll> > vvl;
typedef vector <pair<int,int> > vii;
typedef vector <pair<ll,ll> > vll;
string itos(int n) {stringstream ss;ss<<n;string s=ss.str();return s;}
ll ppow(ll x,ll y,ll mod) {
ll res=1;
while(y) {
if(y&1) res=res*x%mod;
y>>=1;
x=x*x%mod;
}
return res;
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;
cin >> t;
while (t--) {
int n,m;
cin >> n >> m;
int mx=max(m/2-1+m%2+n,n/2-1+n%2+m);
cout << mx << "\n";
if (mx == m/2-1+m%2+n) {
for (int i=1;i<=n;++i) {
for (int j=1;j<=m;++j) {
if (j <= m/2-1+m%2) {
cout << '-';
}
else {
cout << '+';
}
}
cout << "\n";
}
}
else {
for (int i=1;i<=n;++i) {
for (int j=1;j<=m;++j) {
if (i <= n/2-1+n%2) {
cout << '+';
}
else {
cout << '-';
}
}
cout << "\n";
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Incorrect |
3 ms |
376 KB |
Wrong answer in test 5 29: 31 < 32 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
34 ms |
1400 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
1400 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Incorrect |
3 ms |
376 KB |
Wrong answer in test 5 29: 31 < 32 |