# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1108390 | vjudge1 | Art Exhibition (JOI18_art) | C++17 | 129 ms | 12116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
This solution was made by hihihah (Handle codeforces : hihihah)
The local date and time is: Mon Nov 4 10:42:59 2024
The UTC date and time is: Mon Nov 4 03:42:59 2024
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
const int N = 1e9 + 7;
int n;
pii a[500009];
ll f[500009];
void hihihah(){
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 ++)
f[i] = f[i - 1] + a[i].second;
ll mn = -a[1].first;
ll res = 0;
for (int i = 1; i <= n; i ++) {
mn = min (mn, f[i - 1] - a[i].first);
res = max (res, f[i] - a[i].first - mn);
}
cout << res;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
#define orz "mo"
if(fopen(orz".inp", "r")){
freopen(orz".inp", "r", stdin);
freopen(orz".out", "w", stdout);
}
int t = 1;
// cin >> t;
while(t --){
hihihah();
}
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |