제출 #433691

#제출 시각아이디문제언어결과실행 시간메모리
433691KienTranluvChaengArt Exhibition (JOI18_art)C++17
100 / 100
223 ms20852 KiB
#include <bits/stdc++.h> #define int long long #define x first #define y second using namespace std; const int O = 5e5 + 5; int n; pair <int, int> a[O]; main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; ++ i) cin >> a[i].x >> a[i].y; sort(a + 1, a + n + 1); int Min = -a[1].x, ans = a[1].y, sum = a[1].y; for (int i = 2; i <= n; ++ i){ ans = max(ans, sum + a[i].y - a[i].x - Min); ans = max(ans, a[i].y); Min = min(Min, sum - a[i].x); sum += a[i].y; } cout << ans; }

컴파일 시 표준 에러 (stderr) 메시지

art.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...