Submission #672219

# Submission time Handle Problem Language Result Execution time Memory
672219 2022-12-15T05:59:30 Z YENGOYAN Red-blue table (IZhO19_stones) C++17
0 / 100
55 ms 1436 KB
#include <bits/stdc++.h>

using namespace std;

int calc(vector<string> &v, int n, int m){
    int cnt = 0;
    for(int i = 0; i < n; i++){
        int a = 0, b= 0 ;
        for(int j = 0; j < m; j++){
            if(v[i][j] == '+') a++;
            else b++;
        }
        cnt += (a > b);
    }
    for(int j = 0; j < m; j++){
        int a = 0, b = 0;
        for(int i = 0; i < n; i++){
            if(v[i][j] == '-') a++;
            else  b++;
        }
        cnt += (a > b);
    }
    return cnt;
}

void printVec(vector<string> &v, int n, int m){
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cout << v[i][j];
        }
        cout << endl;
    }
}

void solve(){
    int n, m; cin >> n >> m;
    vector<string> v(n);
    string s(m, '-');
    v[0] = s;
    string a(m / 2 + 1, '+'), b(m - (m / 2 + 1), '-');
    for(int i = 1; i < n; i++){
        if(i % 2) v[i] = a + b;
        else v[i] = b + a;
    }
    cout << calc(v, n, m) << endl;
    printVec(v, n, m);
}

int main(){
    int t; cin >> t; while(t--)
        solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 212 KB Wrong answer in test 2 1: 1 < 2
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 1436 KB Wrong answer in test 87 1: 86 < 87
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1220 KB Wrong answer in test 24 24: 34 < 44
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Wrong answer in test 2 1: 1 < 2
3 Halted 0 ms 0 KB -