Submission #1224686

#TimeUsernameProblemLanguageResultExecution timeMemory
1224686nileqRed-blue table (IZhO19_stones)C++20
0 / 100
13 ms1348 KiB
/*
░▒▓███████▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓████████▓▒░▒▓██████▓▒░  
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░      ░▒▓██████▓▒░░▒▓█▓▒░░▒▓█▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓████████▓▒░▒▓████████▓▒░▒▓██████▓▒░  
                                                ░▒▓█▓▒░     
                                                ░▒▓██▓▒░   
*/

// [--------------------------------------------------------------------------------------------]
#include <bits/stdc++.h>
// [--------------------------------------------------------------------------------------------]
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef long double db;

#pragma GCC optimize("O3")

// (( Макросы для имен ))
#define fast_io ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define tests(func) { ll t; cin >> t; while(t-- > 0) func(); }
#define rall(x) all(x), greater<>()
#define all(x) x.begin(), x.end()
#define mat(name, type, size1, size2) vector<vector<type>> name(size1, vector<type>(size2))
#define imax INT_MAX
#define imin INT_MIN
#define llmax LONG_LONG_MAX
#define llmin LONG_LONG_MIN
#define yes cout << "YES" << "\n"
#define no cout << "NO" << "\n"
#define with_precision(x) fixed << setprecision(x)
#define lb lower_bound
#define ub upper_bound
#define endl "\n"

// (( Макросы FOR-цикла с перегрузкой))
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define FOR1(i, n) for(int i = 0; i < (n); i++)
#define FOR2(i, start, end) for(int i = (start); i < (end); i++)
#define FOR(...) GET_MACRO(__VA_ARGS__, FOR2, FOR1)(__VA_ARGS__)

// (( Перегрузки ))

// Пары
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& a){
    return in >> a.first >> a.second;
}

#if __has_include("Utils/debug.hpp")
    #include "Utils/debug.hpp"
#else
    #define timer(...)
    #define debug(...)
#endif

// [----------------------- (( Логика программы )) ------------------------------------]
/*
Попробуем уропситьь задачу:
что если будем выбирать синие или ток красные камешки 
тогда ответ max(n, m), так как взависимости от таблицы нам эффективнее выбирать либо синий либо красный камешек (if n > m)

что если n == 1 и m > 0 (и наоборот):
тогда максимум можно составить n + m - 1 очков в общем, но так как чет из них взаимоуничтожается, то ответ max(n, m) 
*/

const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;

void sol() {
    int n, m;
    cin >> n >> m;

    cout << (n == 1 || m == 1 ? max(n, m) : max(n, m) + 1) << endl;
    if (n == 1) {
        FOR(i, m) cout << "-";
        cout << endl;
        return;
    }

    if (m == 1) {
        FOR(i, n) cout << "+";
        cout << endl;
        return;
    }

    FOR(i, n) {
        FOR(j, m) {
            if (!j) {
                cout << '-';
                continue;
            }
            cout << "+";
        }
        cout << endl;
    }
}

int main(){
    fast_io 

    tests(sol);
    // sol();

    return 0;
}
#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...