結果
問題 |
No.2551 2, 3, 5, 7 Game
|
ユーザー |
|
提出日時 | 2023-12-02 11:30:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 919 bytes |
コンパイル時間 | 1,856 ms |
コンパイル使用メモリ | 210,832 KB |
最終ジャッジ日時 | 2025-02-18 03:21:51 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | MLE * 1 -- * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) constexpr int mxsz = 200000; using bst = bitset<mxsz>; vector<ll> v(mxsz); unordered_map<ll,bst> mp; bst dfs(ll x){ auto itr=mp.find(x); if(itr!=mp.end()) return itr->second; int shf=v.end()-upper_bound(v.begin(),v.end(),x); if(!shf) return mp[x]=0; bst res; res.set(); res>>=shf; res|=dfs(x*2); res|=dfs(x*3); res|=dfs(x*5); res|=dfs(x*7); res.flip(); return mp[x]=res; } int main(){ int t; cin>>t; vector<ll> vv(t); rep(i,t) cin>>vv[i]; vector<bool> ans(t); vector<int> p(t); iota(p.begin(),p.end(),0); sort(p.begin(),p.end(),[&](int a,int b){ return vv[a]<vv[b]; }); for(int j=0;j<t;j++){ v[j]=vv[p[j]]; } for(int j=t;j<mxsz;j++){ v[j]=vv[p.back()]; } bst res=dfs(1); for(int j=0;j<t;j++){ ans[p[j]]=res[j]; } rep(i,t){ cout<<(ans[i]?"ryota\n":"sepa\n"); } }