Submission #1101733

#TimeUsernameProblemLanguageResultExecution timeMemory
1101733kasdoArt Exhibition (JOI18_art)C++14
50 / 100
1065 ms14904 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' #define speed cin.tie (0) -> sync_with_stdio (0);ios_base::sync_with_stdio(false);cin.tie(0); void solve() { int n; cin>>n; pair<int, int> a[n + 5]; for(int i=0; i<n; i++) cin>>a[i].first>>a[i].second; sort(a, a+n); int ans = 0; for(int i=0; i<n; i++) { int sum = 0; for(int j=i; j<n; j++) { sum += a[j].second; ans = max(ans, a[i].first + sum - a[j].first); // -a[j].first + sum + a[i].first; } } cout<<ans<<endl; // 4232545716 } signed main () { speed // freopen("feast.in", "r", stdin); // freopen("feast.out", "w", stdout); int _ = 1; // cin>>_; while(_--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...