Submission #1228876

#TimeUsernameProblemLanguageResultExecution timeMemory
1228876nguthianmangcayArt Exhibition (JOI18_art)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int N=5e5+3; const long long inf=LLONG_MIN; #define ll long long #define fi first #define se second #define pi pair pair<ll,ll>a[N]; int64_t main(){ cin.tie(0)->sync_with_stdio(0); int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].fi>>a[i].se; } sort(a+1,a+1+n); ll ma=-inf; ll tmp=a[1].fi; for(int i=1;i<=n;i++){ ma=max(ma,tmp+a[i].se-a[i].fi); tmp=max(tmp+a[i].se,a[i].fi+a[i].se); } cout<<ma; }

Compilation message (stderr)

art.cpp:10:1: error: '::main' must return 'int'
   10 | int64_t main(){
      | ^~~~~~~
art.cpp: In function 'int main()':
art.cpp:18:11: warning: integer overflow in expression of type 'long long int' results in '-9223372036854775808' [-Woverflow]
   18 |     ll ma=-inf;
      |           ^~~~