Submission #48909

#TimeUsernameProblemLanguageResultExecution timeMemory
48909faustaadpArt Exhibition (JOI18_art)C++17
100 / 100
332 ms243796 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll n,i,ta,tb,tem,has; pair<ll,ll> a[505050]; vector<ll> v; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(i=1;i<=n;i++) { cin>>ta>>tb; a[i]=mp(ta,tb); } sort(a+1,a+1+n); for(i=1;i<=n;i++) { v.pb(-a[i].se); v.pb(a[i].se); if(i<n) v.pb((a[i+1].se)-(a[i+1].fi-a[i].fi)); } for(i=0;i<v.size();i++) { tem+=v[i]; tem=max(tem,0LL); has=max(has,tem); } cout<<has<<"\n"; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:28:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<v.size();i++)
          ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...