답안 #502584

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502584 2022-01-06T09:54:42 Z tim Red-blue table (IZhO19_stones) C++14
11 / 100
23 ms 4812 KB
#include <bits/stdc++.h>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define y1 tim
#define endl "\n"

#define sz(x) (long long)(x).size()
#define all(x) (x).begin(), (x).end()

using namespace std;

mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

int t, n, m, answer, ans[1010][1010], cnt[1010], fl, x;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> t;
    while (t--)
    {
        cin >> n >> m;
        if (m > n)
        {
            answer = m;
            for (int i = 1; i <= n; i++) for (int o = 1; o <= m; o++) ans[i][o] = 0;
            for (int i = 0; i <= m; i++) cnt[i] = 0;
            fl = 0;
            x = 0;
            for (int i = 1; i <= n; i++)
            {
                for (int o = 1; o <= m/2 + m%2; o++)
                {
                    if (cnt[x] + 1 >= n/2 + n%2)
                    {
                        fl = 1;
                        break;
                    }
                    else
                    {
                        cnt[x]++;
                        ans[i][x + 1] = 1;
                        x++;
                    }
                    x %= m;
                }
                if (fl == 1) break;
                answer++;
            }
        }
        else
        {
            answer = n;
            for (int i = 1; i <= n; i++) for (int o = 1; o <= m; o++) ans[i][o] = 1;
            for (int i = 0; i <= n; i++) cnt[i] = 0;
            fl = 0;
            x = 0;
            for (int i = 1; i <= m; i++)
            {
                for (int o = 1; o <= n/2 + n%2; o++)
                {
                    if (cnt[x] + 1 >= m/2 + m%2)
                    {
                        fl = 1;
                        break;
                    }
                    else
                    {
                        cnt[x]++;
                        ans[x + 1][i] = 0;
                        x++;
                    }
                    x %= n;
                }
                if (fl == 1) break;
                answer++;
            }
        }
        cout << answer << endl;
        for (int i = 1; i <= n; i++)
        {
            for (int o = 1; o <= m; o++)
            {
                if (ans[i][o] == 0) cout << "-";
                else cout << "+";
            }
            cout << endl;
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 328 KB in the table A+B is not equal to 6
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 460 KB in the table A+B is not equal to 6
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 328 KB in the table A+B is not equal to 6
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 1728 KB Output is correct
2 Correct 20 ms 4080 KB Output is correct
3 Correct 20 ms 4812 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 1860 KB in the table A+B is not equal to 46
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Incorrect 0 ms 328 KB in the table A+B is not equal to 6