제출 #1228876

#제출 시각아이디문제언어결과실행 시간메모리
1228876nguthianmangcayArt Exhibition (JOI18_art)C++20
컴파일 에러
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;
}

컴파일 시 표준 에러 (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;
      |           ^~~~