Submission #159635

# Submission time Handle Problem Language Result Execution time Memory
159635 2019-10-23T16:13:29 Z Dima_Borchuk Red-blue table (IZhO19_stones) C++17
0 / 100
2000 ms 16288 KB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int q , n , m;
    cin >> q;

    while(q--){
        cin >> n >> m;
        int v[n + 1] = {0}, ans = m , k;
        char a[n + 5][m + 5];

        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                a[i][j] = '-';
            }
        }

        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                if(v[j] < n / 2){
                    a[i][j] = '+';
                    v[j]++;
                }
            }
        }

        for(int i = 1; i <= n; i++){
            k = 0;
            for(int j = 1; j <= n; j++){
                if(a[i][j] == '+') k++;
            }
            if(k > m / 2) ans++;
        }

        cout << ans << endl;

        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= m; j++){
                cout << a[i][j];
            }
            cout << endl;
        }
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 2
# Verdict Execution time Memory Grader output
1 Execution timed out 2025 ms 16288 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 2
# Verdict Execution time Memory Grader output
1 Runtime error 109 ms 1576 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 1272 KB in the table A+B is not equal to 36
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB in the table A+B is not equal to 2