# include<bits/stdc++.h>
#define in freopen ("herding.in", "r", stdin);
#define out freopen("herding.out", "w", stdout);
#define ll long long
#define pb push_back
#define pf push_front
#define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std ;
long long const N = 1e6 + 7 ;
long long N1 = 1e9 + 7 ;
int main( ){
// in out
speed ;
ll TJK = 1 ;
cin >> TJK ;
while( TJK -- ){
ll n , m ;
cin >> n >> m ;
char a[n][m],b[n][m],c[n][m];
ll a1 = n , a2 = m , a3 = 0 ;
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
a[i][j] = '+' ;
}
}
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
b[i][j] = '-' ;
}
}
if( n >= m ){
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
c[i][j] = '+' ;
}
}
ll k = m / 2 ;
if( m % 2 == 0 ){
k -- ;
}
ll k1 = k ;
while( k >= 1 ){
for( int i = 0 ; i < n ; i ++ ){
c[i][k-1] = '-' ;
}
k -- ;
}
/*
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
cout << c[i][j] << ' ' ;
}
cout << endl ;
}*/
a3 = n + k1 ;
//cout << n << ' ' << k << endl ;
}
//cout << a1 << ' ' << a2 << ' ' << a3 << endl ;
if( a1 >= a2 && a1 >= a3 ){
cout << a1 << endl ;
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
cout << a[i][j] << ' ' ;
}
cout << endl ;
}
}else if( a2 >= a1 && a2 >= a3 ){
cout << a2 << endl ;
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
cout << b[i][j] << ' ' ;
}
cout << endl ;
}
}else if( a3 >= a1 && a3 >= a2 ){
cout << a3 << endl ;
for( int i = 0 ; i < n ; i ++ ){
for( int j = 0 ; j < m ; j ++ ){
cout << c[i][j] << ' ';
}
cout << endl ;
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
392 KB |
Wrong answer |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
108 ms |
2412 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
89 ms |
2472 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |