結果
| 問題 |
No.2551 2, 3, 5, 7 Game
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-02 00:54:55 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| コンパイル時間 | 14,035 ms |
| コンパイル使用メモリ | 314,636 KB |
| 最終ジャッジ日時 | 2025-02-18 03:09:07 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 4 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
constexpr int mxsz = 4098;
using bst = bitset<mxsz>;
int t;
vector<ll> v(mxsz);
//gp_hash_table<ll,bst> mp;
unordered_map<ll,bst> mp;
bst dfs(ll x){
auto itr=mp.find(x);
if(itr!=mp.end()) return itr->second;
bst res;
rep(i,mxsz) res[i]=(x>=v[i]);
if((int)res.count()==mxsz) return mp[x]=0;
res|=dfs(x*7);
res|=dfs(x*5);
res|=dfs(x*3);
res|=dfs(x*2);
res.flip();
return mp[x]=res;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>t;
vector<ll> vv(t);
rep(i,t) cin>>vv[i];
vector<int> ans(t,-1);
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 i=0;i<t;i+=mxsz){
mp.clear();
for(int j=i;j<min(i+mxsz,t);j++){
v[j-i]=vv[p[j]];
}
bst res=dfs(1);
for(int j=i;j<min(i+mxsz,t);j++){
ans[p[j]]=res[j-i];
}
}
rep(i,t){
cout<<(ans[i]?"ryota\n":"sepa\n");
}
}