Submission #127317

#TimeUsernameProblemLanguageResultExecution timeMemory
127317TienDungzArt Exhibition (JOI18_art)C++14
0 / 100
2 ms376 KiB
#include<bits/stdc++.h> #define int long long #pragma O3 #pragma Ofast #pragma O3("optimize") using namespace std; typedef pair<int,int> ii; int n,u,v; vector<ii> adj; int tmp=99999999999,res=99999999999,sum=0; signed main() { ios_base::sync_with_stdio(false); cin>>n; for(int i=1;i<=n;i++) { cin>>u>>v; adj.push_back(ii(u,v)); sum+=v; } sort(adj.begin(),adj.end()); for(int i=0;i<n;i++) { tmp=max(tmp,adj[i].first-sum); sum+=adj[i].second; res=max(res,sum+tmp-adj[i].first); } cout<<res; }

Compilation message (stderr)

art.cpp:3:0: warning: ignoring #pragma O3  [-Wunknown-pragmas]
 #pragma O3
 
art.cpp:4:0: warning: ignoring #pragma Ofast  [-Wunknown-pragmas]
 #pragma Ofast
 
art.cpp:5:0: warning: ignoring #pragma O3  [-Wunknown-pragmas]
 #pragma O3("optimize")
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...