Submission #1338323

#TimeUsernameProblemLanguageResultExecution timeMemory
1338323poapaa.Red-blue table (IZhO19_stones)C++20
0 / 100
11 ms1244 KiB
#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n, m, i, j;
    cin >> n >> m;
    if( n > m ) {
        cout << m + n - ( m / 2 + 1 ) << '\n';
        for( i = 0; i < n; i++ ) {
            for( j = 0; j < m; j++ ) {
                if( i < m / 2 + 1 )
                    if( i <= j )
                        cout << '-';
                    else
                        cout << '+';
                else
                    cout << '-';
            }
            cout << '\n';
        }
    } else {
        cout << n + m - ( n / 2 + 1 ) << '\n';
        for( i = 0; i < n; i++ ) {
            for( j = 0; j < m; j++ ) {
                if( j < n / 2 + 1 ) {
                    if( i >= j )
                        cout << '+';
                    else
                        cout << '-';
                } else {
                    cout << '+';
                }
            }
            cout << '\n';
        }
    }
}

int main() {
    int t;
    cin >> t;
    while( t-- ) {
        solve();
    }
    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...