제출 #1156316

#제출 시각아이디문제언어결과실행 시간메모리
1156316RafiullahRed-blue table (IZhO19_stones)C++20
27 / 100
26 ms1352 KiB
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
const int N = 1e6 + 9;
const int LG = 22;

void solve(){
    int n,m;cin >> n >> m;
    int F = max(n + (m - 1) / 2,m + (n - 1) / 2);
    if(n + (m - 1) / 2 >= m + (n - 1) / 2){
        vector<string> a(n + 1,string(m+1,'+'));
        for(int i = 1 ; i <= n ; i ++)
            for(int j = 1 ; j <= (m - 1) / 2; j ++)
                a[i][j] = '-';
        cout << F << endl;
        for(int i = 1 ; i <= n ; i ++){
            for(int j = 1 ; j <= m ; j ++){
                cout << a[i][j] ;
            }
            cout << endl;
        }
    }
    else{
        vector<string> a(n + 1,string(m+1,'-'));
        for(int j = 1 ; j <= m ; j ++)
            for(int i = 1 ; i <= (n - 1) / 2;  i ++)
                a[i][j] = '+';
        cout << F << endl;
        for(int i = 1 ; i <= n ; i ++){
            for(int j = 1 ; j <= m ; j ++){
                cout << a[i][j] ;
            }
            cout << endl;
        }
    }
    
}
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    cin >> t;
    while(t --){
        solve();
    }
}
#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...