# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70824 | someone_aa | Art Exhibition (JOI18_art) | C++17 | 1082 ms | 41140 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 500100;
map<ll, ll> sum;
vector<pair<ll, ll> > values;
vector<ll> pref;
ll n, x, y;
ll get_val(int l, int r) {
ll sum =1LL* pref[r] - pref[l-1];
ll diff = values[r].first - values[l].first;
return sum - diff;
}
int main() {
cin>>n;
for(int i=0;i<n;i++) {
cin>>x>>y;
sum[x] += y;
}
values.pb(mp(0LL,0LL));
pref.pb(0LL);
for(auto i:sum) {
values.pb(mp(i.first, i.second));
pref.pb(pref.back() + i.second);
}
ll l = 1LL;
ll result = 0LL;
for(ll i=1;i<values.size();i++) {
for(ll j=1;j<=i;j++) {
result = max(result, get_val(j, i));
}
}
cout<<result;
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... |