제출 #972404

#제출 시각아이디문제언어결과실행 시간메모리
972404vjudge1Art Exhibition (JOI18_art)C++17
100 / 100
149 ms21316 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define pon ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int T=1; #define ponchik signed main #define pb push_back #define pf push_front #define endl "\n" #define F first #define S second const int N=1e5+69,INF=1e18+1488; int cnt[N]; map<pair<int,int>,int>mp; void solve() { int n; vector <pair<int,int>> v; cin>>n; for (int i=0; i<n; i++) { int a,b; cin>>a>>b; v.pb({a,b}); } sort(v.begin(),v.end()); int mx=v[0].S,c=v[0].S; for (int i=1; i<n; i++) { c+=v[i].S; c-=v[i].F-v[i-1].F; if (v[i].S>c) c=v[i].S; mx=max(mx,c); } cout<<mx; } ponchik (/*Alfar ABI*/ ) { pon // freopen( "###.in" ,"r",stdin); freopen( "###.out" ,"w",stdout); // cin>>T; while (T--){solve();} } //2 3 //4 5 //11 2
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...