Submission #173024

#TimeUsernameProblemLanguageResultExecution timeMemory
173024RakhmandRed-blue table (IZhO19_stones)C++14
27 / 100
43 ms1384 KiB
//
//  Road2Master.cpp
//  Road2Master
//
//  Created by Rakhman Abdirashov on 12/14/19.
//  Copyright © 2019 Rakhman Abdirashov. All rights reserved.
//
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>
 
#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define no_answer {cout << "NO"; exit(0);}
#define FOR(i, start, finish, k) for(llong i = start; i <= finish; i += k)
 
const long long MXN = 1e5 + 10;
const long long MNN = 1e4 + 520;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9;
 
typedef long long llong;
typedef unsigned long long ullong;
 
using namespace std;

int n, m;

void output(int n, int m){
    cout << max(n, m) + (min(n, m) - 1) / 2 << nl;
    if(n >= m){
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= (m - 1) / 2; j++){
                cout << '-';
            }
            for(int j = (m - 1) / 2 + 1; j <= m; j++){
                cout << '+';
            }
            cout << nl;
        }
    }else{
        for(int i = 1; i <= (n - 1) / 2; i++){
            for(int j = 1; j <= m; j++){
                cout << '+';
            }
            cout << nl;
        }
        for(int i = (n - 1) / 2 + 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                cout << '-';
            }
            cout << nl;
        }
    }
}

int main(){
    int t;
    cin >> t;
    while(t--){
        cin >> n >> m;
        output(n, m);
    }
}
/*
 1 2 3 4 5 6
 2 3 4 1 5 6
 4 1 5 2 3 6
 
 4 5
 +++--
 +++--
 +++--
 +++--
 
 4 + 2
 
 +++++
 +++++
 -----
 -----
 -----
 
 5 + 2
 
 
 4 + 2
 */
#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...