結果

問題 No.3300 Frog Game
ユーザー startcpp
提出日時 2025-10-05 14:21:45
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 82,872 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-05 14:21:47
合計ジャッジ時間 1,869 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cstdio>
#include <cassert>
#include <atcoder/modint>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;
using namespace atcoder;

int a, b, n;
vector<int> g;

int dfs(int x) {
    if (x < 0) return 1;
    if (g[x] != -1) return g[x];

    set<int> st;
    st.insert(dfs(x - a));
    st.insert(dfs(x - b));

    int i;
    for (i = 0; ; i++) {
        if (st.find(i) == st.end()) break;
    }
    return g[x] = i;
}

bool solve(int x) {
    x %= a + b;
    if (x < b) return (x / a) % 2 == 1 ? true : false;
    return !solve(x - a) || !solve(x - b);
}

signed main() {
    cin >> n >> a >> b;
    n -= 2;
    if (solve(n)) cout << "sepa" << endl;
    else cout << "ryota" << endl;
    
    /*g = vector<int>(n + 1, -1);
    for (int i = 0; i <= n; i++) {
        bool res1 = dfs(i);
        bool res2 = solve(i);
        if (res1 != res2) { cout << "WA " << i << ": " << res1 << ", " << res2 << endl; }
    }
    cout << "OK" << endl;*/
    return 0;
}
0