Submission #331653

# Submission time Handle Problem Language Result Execution time Memory
331653 2020-11-29T11:24:20 Z AKiko Red-blue table (IZhO19_stones) C++14
27 / 100
55 ms 1388 KB
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ss second
#define ff first
#define pb push_back
#define pii pair<int, int>
#define INF INT_MAX
#define debug(n) cout << #n << " = " << n << "\n";
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll MOD = 1e9 + 7;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<vector<char> > res( n, vector<char>( m ) );
    if(n > m) {
        // more red (+)
        
        for(int i = 0; i < n; i++) {
            res[i][m - 1] = '+';
            for(int j = 0; j < m - 1; j ++) {
                if(j & 1) {
                    res[i][j] = '-';
                } else {
                    res[i][j] = '+';
                }
            }
        }
        cout << n + (m - 1) / 2 << "\n";
    } else {
        // more blue (-)    
        for(int i = 0; i < m; i++) {
            res[n - 1][i] = '-';
            for(int j = 0; j < n - 1; j++) {
                if(j & 1)  
                    res[j][i] = '+';
                else
                    res[j][i] = '-';
            }
        }
        cout << m + (n - 1) / 2 << "\n";
    }
    for(auto  line : res) {
        for(char c : line) {
            cout << c;
        }
        cout << "\n";
    }
}


int main() {
    // FAST
        int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Incorrect 5 ms 364 KB Wrong answer in test 5 29: 31 < 32
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 1388 KB Wrong answer in test 97 21: 107 < 116
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 1388 KB Wrong answer in test 24 24: 35 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Incorrect 5 ms 364 KB Wrong answer in test 5 29: 31 < 32