Submission #312437

#TimeUsernameProblemLanguageResultExecution timeMemory
312437a_playerArt Exhibition (JOI18_art)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define f first #define s second using namespace std; typedef long long ll; int main(){ int n; cin>>n; vector<pair<ll,ll> > a(n); for(int i=0;i<n;i++)cin>>a[i].f>>a[i].s; sort(a.begin(),a.end()); ll mini=-a[i].f; ll mas=LLONG_MIN; ll s=0; for(int i=0;i<n;i++){ mas=max(mas,s+a[i].s-mini-a[i].f); mini=min(mini,s-a[i].f); s+=a[i].s; } cout<<mas<<endl; }

Compilation message (stderr)

art.cpp: In function 'int main()':
art.cpp:14:14: error: 'i' was not declared in this scope
   14 |   ll mini=-a[i].f;
      |              ^