제출 #825226

#제출 시각아이디문제언어결과실행 시간메모리
825226dijbkrArt Exhibition (JOI18_art)C++14
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> typedef long long ll; typedef unsigned long long ull; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin >> n; pair<ll,ll>p[n+2]; for (ll i=1; i<=n; i++) { cin >> p[i].first >> p[i].second; } sort(p+1,p+n+1); ll pref[n+4]; memset(pref,0,sizeof(pref)); for (ll i=1; i<=n; i++) { pref[i]=pref[i-1]+p[i].second; } ll ans=0; for (ll i=1; i<n; i++) { for (ll j=i+1; j<=n; j+=i) { ans=max(ans,(pref[j]-pref[i-1])-p[j].first+p[i].first); } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...