Submission #736702

# Submission time Handle Problem Language Result Execution time Memory
736702 2023-05-06T06:29:59 Z puppy Gardening (RMI21_gardening) C++17
11 / 100
60 ms 608 KB
#include <iostream>
#include <vector>
using namespace std;

void solve()
{
    int N, M, K; cin >> N >> M >> K;
    if (N == 1) {
        cout << "NO\n";
        return;
    }
    else if (N == 2) {
        if (2 * K == M) {
            cout << "YES\n";
            for (int tt = 0; tt < 2; tt++) {
                for (int i = 0; i < M; i++) {
                    cout << (i / 2 + 1) << ' ';
                }
                cout << '\n';
            }
            return;
        }
        else {
            cout << "NO\n";
            return;
        }
    }
    else if (N == 3) {
        cout << "NO\n";
        return;
    }
    else if (N == 4) {
        if (M % 2 || K == M - 1) {
            cout << "NO\n";
            return;
        }
        else {
            if (M / 2 <= K && K <= M) {
                cout << "YES\n";
                vector<vector<int>> ans(4, vector<int>(M));
                //2K-M+1 2K-M+2 ... M에서 총 2M-2K개. (i-(2K-M+1))/2 + 2K- M + 1
                //K - M/2 까지
                for (int i = 0; i < 2 * K - M; i++) {
                    ans[0][i] = ans[1][i] = i / 2 + 1;
                    ans[2][i] = ans[3][i] = i / 2 + K - M / 2 + 1;
                }
                if (K != M) {
                    for (int i = 2 * K - M; i < M; i++) ans[0][i] = ans[3][i] = 2 * K - M + 1;
                    ans[1][2*K-M] = ans[2][2*K-M] = ans[1][M-1] = ans[2][M-1] = 2 * K - M + 1;
                    //2*K-M+2~K까지 총 M - K - 1개 만들기
                    for (int i = 0; i < M - K - 1; i++) {
                        int color = i + 2 * K - M + 2;
                        ans[1][2*K-M+1+2*i] = ans[2][2*K-M+1+2*i] = ans[1][2*K-M+2+2*i] = ans[2][2*K-M+2+2*i] = color;
                    }
                }
                for (int i = 0; i < 4; i++) {
                    for (int j = 0; j < M; j++) {
                        cout << ans[i][j] << ' ';
                    }
                    cout << '\n';
                }
            }
            else {
                cout << "NO\n";
            }
        }
    }
}

int main()
{
    //ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int T; cin >> T;
    while (T--) {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 60 ms 592 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 60 ms 592 KB Correct! Azusa and Laika like the garden :)
2 Correct 15 ms 608 KB Correct! Azusa and Laika like the garden :)
3 Correct 15 ms 540 KB Correct! Azusa and Laika like the garden :)
# Verdict Execution time Memory Grader output
1 Correct 60 ms 592 KB Correct! Azusa and Laika like the garden :)
2 Correct 15 ms 608 KB Correct! Azusa and Laika like the garden :)
3 Correct 15 ms 540 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 11 ms 520 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 212 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 0 ms 212 KB Incorrect output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 592 KB Correct! Azusa and Laika like the garden :)
2 Correct 15 ms 608 KB Correct! Azusa and Laika like the garden :)
3 Correct 15 ms 540 KB Correct! Azusa and Laika like the garden :)
4 Incorrect 11 ms 520 KB Expected integer, but "YES" found
5 Halted 0 ms 0 KB -