Submission #127277

# Submission time Handle Problem Language Result Execution time Memory
127277 2019-07-09T07:46:27 Z gaoxam123 Art Exhibition (JOI18_art) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
/dit me oj.uz
#define int long long
int n,ans=-1e15,tmp=-1e15,sum=-1e15;pair<int,int> a[500005];
signed main(){
	ios_base::sync_with_stdio(0); cin.tie(o);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:3:1: error: expected unqualified-id before '/' token
 /dit me oj.uz
 ^
art.cpp: In function 'int main()':
art.cpp:7:40: error: 'o' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                        ^
art.cpp:7:48: error: 'n' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                ^
art.cpp:7:139: error: 'tmp' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                           ^~~
art.cpp:7:139: note: suggested alternative: 'tm'
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                           ^~~
                                                                                                                                           tm
art.cpp:7:162: error: 'sum' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                                                  ^~~
art.cpp:7:184: error: 'ans' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                                                                        ^~~
art.cpp:7:184: note: suggested alternative: 'abs'
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                                                                        ^~~
                                                                                                                                                                                        abs
art.cpp:7:223: error: 'ans' was not declared in this scope
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                                                                                                               ^~~
art.cpp:7:223: note: suggested alternative: 'abs'
  ios_base::sync_with_stdio(0); cin.tie(o);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;
                                                                                                                                                                                                                               ^~~
                                                                                                                                                                                                                               abs