| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1212370 | 2ia7a8e6a7 | Art Exhibition (JOI18_art) | C++20 | 0 ms | 320 KiB |
#include <bits/stdc++.h>
using namespace std;
pair<long long, long long>f[500005];
int main(){
f[0]={0, 0};
int n;
long long hmax=-1e9;
cin>>n;
for(int i=1; i<=n; i++){
cin>>f[i].first>>f[i].second;
}
sort(f+1, f+n+1);
for(int i=2; i<=n; i++){
f[i].second+=f[i-1].second;
}
long long dmin=-f[1].first;
for(int i=1; i<=n; i++){
hmax=max(hmax, f[i].second-f[i].first-dmin);
dmin=min(dmin, f[i-1].second-f[i].first);
}
cout<<hmax;
return 0;
}
| # | 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... | ||||
