이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
ll n, a, b, mn, ans, sum;
vector<pair<ll, ll>> v;
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
cin >> a >> b;
v.emplace_back(a, b);
}
sort(all(v));
mn = 1e18;
for(int i = 0; i < n; i++){
auto&[a, b] = v[i];
mn = min(mn, sum - a);
sum += b;
ans = max(ans, sum - a - mn);
}
cout << ans;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
art.cpp: In function 'int main()':
art.cpp:21:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
21 | auto&[a, b] = v[i];
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |