結果
問題 |
No.3300 Frog Game
|
ユーザー |
|
提出日時 | 2025-10-05 16:15:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,027 bytes |
コンパイル時間 | 2,752 ms |
コンパイル使用メモリ | 278,352 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-10-05 16:15:50 |
合計ジャッジ時間 | 4,111 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; bool solve(int n,int a,int b){ vector<bool> dp(n+1); for(int i=1;i<=n;i++){ if(i>=a&&dp[i-a]==false)dp[i]=true; if(i>=b&&dp[i-b]==false)dp[i]=true; } return dp[n-2]; for(int i=0;i<=n;i++){ int idx=i; while(idx<=n&&dp[idx]==dp[i])idx++; if(dp[i])cout<<"o:"<<idx-i<<endl; else cout<<"x:"<<idx-i<<endl; i=idx-1; } } bool solve2(ll n,ll a,ll b){ n-=2; if(n<a)return false; else if(n<b){ if(n/a%2==1)return true; else return false; } ll x=(b-1)%(2*a)+1; if(x<=a){ n-=b; n%=(a+b); if(n<(a+b-x))return n/a%2==0; else return false; }else{ n%=(a+b); if(n<(a+b-x))return n/a%2==1; else return true; } } int main(){ /* random_device seed; mt19937 rnd(seed()); int q=1000; while(q--){ int n=rnd()%1000+2; int a=rnd()%1000+1; int b=rnd()%500+a; if(solve(n,a,b)!=solve2(n,a,b)){ cout<<n<<" "<<a<<" "<<b<<endl; } }*/ ll n,a,b; cin>>n>>a>>b; if(solve2(n,a,b))cout<<"sepa"<<endl; else cout<<"ryota"<<endl; }