제출 #752239

#제출 시각아이디문제언어결과실행 시간메모리
752239vjudge1Art Exhibition (JOI18_art)C++11
100 / 100
222 ms11312 KiB
#include<bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define down "\n" #define ll long long #define fi first #define se second #define fon(i, x, y) for(int i = (x), _y = (y); i <= _y; ++ i) #define fol(i, x, y) for(int i = (x), _y = (y); i >= _y; -- i) #define po 1000000000000000000 #define ne -1000000000000000000 #define ii pair<ll, ll> using namespace std; const ll int maxn = 1e6 + 10; const ll int N = 1503; // ▄▄▄▄ ▄▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄▄▄▄ ▄▄▄▄ // █▄▄█ ██ █ █▄▄█ █▄█ █▄▄█ █ █ █▄▄█ // █ █ █ ██ █ █ █ █ █ █ █▄▄█ █ █ ii a[maxn]; ll oo = 1e18; ll n; void inp(){ cin>>n; fon(i, 1, n) cin>>a[i].fi>>a[i].se; } void solve(){ sort(a+1, a+n+1); ll i2 = 1; ll tong = 0; ll kq = 0-oo; fon(i, 1, n){ if(tong < a[i].fi-a[i2].fi){ tong = 0; i2 = i; } tong = tong + a[i].se; kq = max(kq, tong - (a[i].fi-a[i2].fi)); } cout<<kq; } int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); inp(); solve(); } /**/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...