結果
問題 | No.2718 Best Consonance |
ユーザー |
![]() |
提出日時 | 2024-06-26 18:33:36 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 919 bytes |
コンパイル時間 | 5,496 ms |
コンパイル使用メモリ | 316,300 KB |
実行使用メモリ | 284,356 KB |
最終ジャッジ日時 | 2024-06-26 18:34:07 |
合計ジャッジ時間 | 27,552 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 34 RE * 2 |
ソースコード
#include<bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair<int,int>; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n;cin>>n; vc<pp>v(n); for(auto&[a,b]:v)cin>>a>>b; int m=2e5+5; vc d(m,vc<int>(0)); for(int i=1;i<m;i++)for(int j=i;j<m;j+=i)d[j].pb(i); vc dx(m,vc<pp>(0)); for(auto p:v)for(auto au:d[p.fi])dx[au].pb(p); int ans=0; for(int i=1;i<m;i++){ auto& vx=dx[i]; sort(all(vx),[&](pp a,pp b){ return (ll)a.fi*a.se>=(ll)b.fi*b.se; }); int mn=1e9+5; for(auto [a,b]:vx){ ans=max(ans,b/mn); mn=min(mn,a/i); } } cout<<ans; }