# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
819397 | AdamGS | Cake 3 (JOI19_cake3) | C++17 | 2971 ms | 22952 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const ll INF=1e18+7;
const int LIM=2e5+7;
pair<ll,ll>T[LIM], dp[LIM];
multiset<ll>S;
vector<pair<ll,ll>>rollback;
ll akt, n, m;
void upd(int x) {
S.insert(T[x].nd);
akt+=T[x].nd;
if(S.size()>m-2) {
rollback.pb({T[x].nd, *S.begin()});
akt-=*S.begin();
S.erase(S.begin());
} else rollback.pb({T[x].nd, -1});
}
void undo() {
if(rollback.back().nd!=-1) {
akt+=rollback.back().nd;
S.insert(rollback.back().nd);
}
akt-=rollback.back().st;
S.erase(S.find(rollback.back().st));
컴파일 시 표준 에러 (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... |