結果

問題 No.3300 Frog Game
ユーザー ripity
提出日時 2025-10-05 15:23:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,311 bytes
コンパイル時間 5,500 ms
コンパイル使用メモリ 335,064 KB
実行使用メモリ 7,840 KB
最終ジャッジ日時 2025-10-05 15:23:43
合計ジャッジ時間 5,813 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using mint = modint998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N, A, B;
    cin >> N >> A >> B;
    ll g = gcd(N, gcd(A, B));
    N /= g, A /= g, B /= g;
    string ans = "";
    if(A != 1) {
        ans = ((N - 2) % (A + B) < B ? "ryota" : "sepa");
    }else if(A == 1 && B % 2 == 1) {
        if(N == 1) {
            ans = "sepa";
        }else if(N <= B + 1) {
            ans = "ryota";
        }else if(N % 2 == 1) {
            ans = "sepa";
        }else {
            ans = "ryota";
        }
    }else if(A == 1 && B % 2 == 0) {
        if(N == 1) {
            ans = "sepa";
        }else if(N <= B + 1) {
            ans = "ryota";
        }else if(N % (B + 1) == 0 || N % (B + 1) % 2 == 1) {
            ans = "ryota";
        }else {
            ans = "sepa";
        }
    }
    cout << ans << endl;

    if(N > 500) return 0;
    vector<int> dp(N + A + B, 1);
    for(int i = N - 1; i >= 0; i--) {
        dp[i] = (1 - dp[i + A]) & (1 - dp[i + B]);
    }
    for(int i = 1; i <= N; i++) {
        cout << dp[i] << " \n"[i == N];
    }
    cout << endl;

    assert((dp[1] == 1 && ans == "sepa") || (dp[1] == 0 && ans == "ryota"));
}
0