結果
問題 | No.2718 Best Consonance |
ユーザー |
![]() |
提出日時 | 2024-06-26 20:03:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,996 ms / 4,000 ms |
コード長 | 918 bytes |
コンパイル時間 | 5,365 ms |
コンパイル使用メモリ | 317,372 KB |
実行使用メモリ | 284,480 KB |
最終ジャッジ日時 | 2024-06-26 20:04:07 |
合計ジャッジ時間 | 26,363 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 |
ソースコード
#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;}