結果
問題 | No.2718 Best Consonance |
ユーザー | 👑 potato167 |
提出日時 | 2024-04-05 21:57:21 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 873 ms / 4,000 ms |
コード長 | 2,603 bytes |
コンパイル時間 | 2,510 ms |
コンパイル使用メモリ | 208,384 KB |
実行使用メモリ | 29,488 KB |
最終ジャッジ日時 | 2024-04-10 10:50:23 |
合計ジャッジ時間 | 13,748 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 135 ms
26,232 KB |
testcase_01 | AC | 142 ms
26,200 KB |
testcase_02 | AC | 145 ms
26,140 KB |
testcase_03 | AC | 137 ms
26,224 KB |
testcase_04 | AC | 138 ms
26,024 KB |
testcase_05 | AC | 138 ms
26,024 KB |
testcase_06 | AC | 139 ms
26,136 KB |
testcase_07 | AC | 137 ms
26,084 KB |
testcase_08 | AC | 141 ms
26,380 KB |
testcase_09 | AC | 140 ms
26,344 KB |
testcase_10 | AC | 141 ms
26,328 KB |
testcase_11 | AC | 136 ms
26,224 KB |
testcase_12 | AC | 137 ms
26,188 KB |
testcase_13 | AC | 145 ms
26,228 KB |
testcase_14 | AC | 268 ms
29,164 KB |
testcase_15 | AC | 241 ms
28,544 KB |
testcase_16 | AC | 248 ms
28,596 KB |
testcase_17 | AC | 239 ms
28,172 KB |
testcase_18 | AC | 256 ms
28,764 KB |
testcase_19 | AC | 229 ms
28,448 KB |
testcase_20 | AC | 276 ms
29,152 KB |
testcase_21 | AC | 279 ms
29,040 KB |
testcase_22 | AC | 272 ms
29,008 KB |
testcase_23 | AC | 213 ms
27,876 KB |
testcase_24 | AC | 316 ms
29,348 KB |
testcase_25 | AC | 325 ms
29,264 KB |
testcase_26 | AC | 318 ms
29,384 KB |
testcase_27 | AC | 334 ms
29,312 KB |
testcase_28 | AC | 330 ms
29,488 KB |
testcase_29 | AC | 350 ms
29,352 KB |
testcase_30 | AC | 300 ms
29,432 KB |
testcase_31 | AC | 303 ms
29,208 KB |
testcase_32 | AC | 357 ms
29,348 KB |
testcase_33 | AC | 317 ms
29,380 KB |
testcase_34 | AC | 147 ms
26,224 KB |
testcase_35 | AC | 148 ms
26,084 KB |
testcase_36 | AC | 391 ms
29,296 KB |
testcase_37 | AC | 167 ms
26,132 KB |
testcase_38 | AC | 873 ms
29,348 KB |
testcase_39 | AC | 140 ms
26,204 KB |
ソースコード
#include <bits/stdc++.h> #pragma GCC optimize("unroll-loops") using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; using ld=long double; const ll ILL=2167167167167167167; const int INF=2100000000; const int mod=998244353; #define rep(i,a,b) for (int i=(int)(a);i<(int)(b);i++) #define all(p) p.begin(),p.end() template<class T> using _pq = priority_queue<T, vector<T>, greater<T>>; template<class T> ll LB(vector<T> &v,T a){return lower_bound(v.begin(),v.end(),a)-v.begin();} template<class T> ll UB(vector<T> &v,T a){return upper_bound(v.begin(),v.end(),a)-v.begin();} template<class T> bool chmin(T &a,T b){if(a>b){a=b;return 1;}else return 0;} template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;} template<class T> void So(vector<T> &v) {sort(v.begin(),v.end());} template<class T> void Sore(vector<T> &v) {sort(v.begin(),v.end(),[](T x,T y){return x>y;});} void yneos(bool a,bool upp=0){if(a) cout<<(upp?"YES\n":"Yes\n"); else cout<<(upp?"NO\n":"No\n");} template<class T> void vec_out(vector<T> &p,int ty=0){ if(ty==2){cout<<'{';for(int i=0;i<(int)p.size();i++){if(i){cout<<",";}cout<<'"'<<p[i]<<'"';}cout<<"}\n";} else{if(ty==1){cout<<p.size()<<"\n";}for(int i=0;i<(int)(p.size());i++){if(i) cout<<" ";cout<<p[i];}cout<<"\n";}} template<class T> T vec_min(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmin(ans,x);return ans;} template<class T> T vec_max(vector<T> &a){assert(!a.empty());T ans=a[0];for(auto &x:a) chmax(ans,x);return ans;} template<class T> T vec_sum(vector<T> &a){T ans=T(0);for(auto &x:a) ans+=x;return ans;} int pop_count(long long a){int res=0;while(a){res+=(a&1),a>>=1;}return res;} //return divisors list 1~uuper //O(upper\log(upper)) std::vector<std::vector<int>> divisors_table(int upper){ std::vector<std::vector<int>> res(upper+1); for(int i=1;i<=upper;i++){ for(int j=i;j<=upper;j+=i){ res[j].push_back(i); } } return res; } void solve(); // oddloop int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t=1; //cin>>t; rep(i,0,t) solve(); } void solve(){ int N; cin>>N; vector<pair<ll,ll>> A(N); rep(i,0,N) cin>>A[i].first>>A[i].second; sort(all(A),[&](pair<ll,ll> l,pair<ll,ll> r){ return l.first*l.second<r.first*r.second; }); auto tmp=divisors_table(200200); vector<ll> B(200200); ll ans=0; rep(i,0,N){ for(auto x:tmp[A[i].first]){ chmax(ans,B[x]/(A[i].first/x)); chmax(B[x],A[i].second); } } cout<<ans<<"\n"; }