Submission #329097

#TimeUsernameProblemLanguageResultExecution timeMemory
329097Habib_AssoevRed-blue table (IZhO19_stones)C++17
0 / 100
108 ms2472 KiB
# 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 ; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...