Submission #674305

# Submission time Handle Problem Language Result Execution time Memory
674305 2022-12-23T16:48:01 Z Halym2007 Red-blue table (IZhO19_stones) C++17
0 / 100
30 ms 1228 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 100005;

void solve();
int a1, a2, t, n, m;
int main() {
	ios::sync_with_stdio(false);
 	cin.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
 	cin >> t;
    while ( t-- ) {
        cin >> n >> m;
        if (n == 1 or m == 1) {
            if (n >= m) {
                cout << n << "\n";
                for (int i = 1; i <= n; ++i) {
                    for (int j = 1; j <= m; ++j) {
                        cout << "+";
                    }
                    cout << "\n";
                }
            }
            else {
                cout << m << "\n";
                for (int i = 1; i <= n; ++i) {
                    for (int j = 1; j <= m; ++j) {
                        cout << "-";
                    }
                    cout << "\n";
                }
            }
        }
        else if (n >= m) {
            cout << n + ((m - 1) / 2) << "\n";
            for (int i = 1; i <= n; ++i) {
                a1 = (n / 2) + 1;
                for (int j = 1; j <= m; ++j) {
                    if (a1 >= 1) {
                        cout << "+";
                        a1--;
                    }
                    else cout << "-";   
                }
                cout << "\n";
            }
        }
        else {
            a1 = (n / 2) + 1;
            cout << m + ((n - 1) / 2) << "\n";
            for (int i = 1; i <= n; ++i) {
                if (a1 >= 1) {
                    for (int j = 1; j <= m; ++j) cout << "-";
                    a1--;
                }
                else {
                    for (int j = 1; j <= m; ++j) cout << "+";
                }
                cout << "\n";
            }
        }

        cout << "\n";
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB in the table A+B is not equal to 5
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 in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 1228 KB in the table A+B is not equal to 107
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 1228 KB Wrong answer in test 24 24: 35 < 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 in the table A+B is not equal to 5
3 Halted 0 ms 0 KB -