Submission #248913

#TimeUsernameProblemLanguageResultExecution timeMemory
248913rocks03Art Exhibition (JOI18_art)C++14
50 / 100
1061 ms21016 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<ll,ll> #define ff first #define ss second #define pb push_back main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<pii> v(N); for(int i = 0; i < N; i++) cin >> v[i].ff >> v[i].ss; sort(v.begin(), v.end()); ll ans = 0; for(int i = 0; i < N; i++){ ll sum = 0; for(int j = i; j < N; j++){ sum += v[j].ss; ans = max(ans, sum - v[j].ff + v[i].ff); } } cout << ans; }

Compilation message (stderr)

art.cpp:9:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...