#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2")
#pragma GCC optimize("unroll-loops")
#define ll long long
#define ld long double
#define ull unsigned long long
#define ui unsigned int
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define pf push_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define plli pair<long long, int>
#define pdi pair<double, int>
#define pldldi pair<ld, pair<ld, int>>
#define pdd pair<double, double>
#define pid pair<int, double>
#define piii pair<int, pair<int, int>>
#define pllll pair<long long, long long>
#define pllllll pair<ll, pllll>
#define INF 2e9 + 5
#define size(v) v.size()
#define f first
#define s second
#define Pi 3.14159265359
using namespace std;
int Choice1(int n, int m){
int x = n / 2;
if(x * 2 == n){
x--;
}
return x + m;
}
int Choice2(int n, int m){
int x = m / 2;
if(x * 2 == m){
x--;
}
return x + n;
}
void solve(){
int n, m;
cin >> n >> m;
if(Choice1(n, m) > Choice2(n, m)){
cout << Choice1(n, m) << "\n";
int x = Choice1(n, m) - m;
vector<vector<char>>grid(n + 1, vector<char>(m + 1, '-'));
for(int i = 1; i <= x; i++){
for(int j = 1; j <= m; j++){
grid[i][j] = '+';
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cout << grid[i][j];
}
cout << "\n";
}
}else{
cout << Choice2(n, m) << "\n";
int x = Choice2(n, m) - n;
vector<vector<char>>grid(n + 1, vector<char>(m + 1, '+'));
for(int i = 1; i <= x; i++){
for(int j = 1; j <= n; j++){
grid[j][i] = '-';
}
}
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cout << grid[i][j];
}
cout << "\n";
}
}
}
int main(){
int t;
// t = 1;
cin >> t;
while(t--){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
1248 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
1228 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |