Submission #127281

# Submission time Handle Problem Language Result Execution time Memory
127281 2019-07-09T07:48:12 Z gaoxam123 Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#pragma optimize(O3)
using namespace std;
//dit me oj.uz
int n,ans=-1e15,tmp=-1e15,sum=-1e15;pair<int,int> a[500005];
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);cin>>n;for(int i=1;i<=n;i++) cin>>a[i].first>>a[i].second;sort(a+1,a+n+1);for(int i=1;i<=n;i++){tmp=max(tmp,a[i].first-sum);sum+=a[i].second;ans=max(ans,sum-a[i].first+tmp);}cout<<ans;
}

Compilation message

art.cpp:2:0: warning: ignoring #pragma optimize  [-Wunknown-pragmas]
 #pragma optimize(O3)
 
art.cpp:5:12: warning: overflow in implicit constant conversion [-Woverflow]
 int n,ans=-1e15,tmp=-1e15,sum=-1e15;pair<int,int> a[500005];
            ^~~~
art.cpp:5:22: warning: overflow in implicit constant conversion [-Woverflow]
 int n,ans=-1e15,tmp=-1e15,sum=-1e15;pair<int,int> a[500005];
                      ^~~~
art.cpp:5:32: warning: overflow in implicit constant conversion [-Woverflow]
 int n,ans=-1e15,tmp=-1e15,sum=-1e15;pair<int,int> a[500005];
                                ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -