Submission #127274

#TimeUsernameProblemLanguageResultExecution timeMemory
127274gaoxam123Art Exhibition (JOI18_art)C++14
Compilation error
0 ms0 KiB
#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(){ 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 (stderr)

art.cpp:3:1: error: expected unqualified-id before '/' token
 /dit me oj.uz
 ^
art.cpp: In function 'int main()':
art.cpp:7:7: error: 'n' was not declared in this scope
  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:98: error: 'tmp' was not declared in this scope
  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:98: note: suggested alternative: 'tm'
  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:121: error: 'sum' was not declared in this scope
  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:143: error: 'ans' was not declared in this scope
  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:143: note: suggested alternative: 'abs'
  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:182: error: 'ans' was not declared in this scope
  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:182: note: suggested alternative: 'abs'
  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