Submission #344125

#TimeUsernameProblemLanguageResultExecution timeMemory
344125koketsuRed-blue table (IZhO19_stones)C++14
0 / 100
38 ms1388 KiB
#include <bits/stdc++.h>
#define pb push_back
#define LL long long
#define Kultivator ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const LL Mxn = 1e6 + 7;
const LL Mod = 1e9 + 7;
const LL Inf = 1e14 + 7;

int main(){
    Kultivator;
    int tt;
    cin >> tt;
    while(tt--){
        int N, M;
        cin >> N >> M;
        if(N % 2 && M % 2){
            cout << max(N, M) + (min(N, M) / 2) << '\n';
            for(int i = 1; i <= N; i++){
                    for(int j = 1; j <= M; j++){
                        if(N <= M){
                            if(j % 2){
                                cout << '+';
                            } else {
                                cout << '-';
                            }
                        } else {
                            if(i % 2){
                                cout << '-';
                            } else {
                                cout << '+';
                            }
                        }
                    }
                    cout << '\n';
                }
        } else if(N == M){
            if(!(N % 2)){
                cout << N + max(0, (N / 2) - 1) << '\n';
                for(int i = 1; i <= N; i++){
                    for(int j = 1; j <= M; j++){
                        if(i > (N / 2) + 1){
                            cout << '+';
                        } else {
                            cout << '-';
                        }
                    }
                    cout << '\n';
                }
            } else {
                cout << N + max(0, N / 2) << '\n';
                for(int i = 1; i <= N; i++){
                    for(int j = 1; j <= M; j++){
                        if(j % 2){
                            cout << '+';
                        } else {
                            cout << '-';
                        }
                    }
                    cout << '\n';
                }
            }
        }

        cout << '\n';
    }
}
#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...