# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199463 | dennisstar | Sushi (JOI16_sushi) | C++17 | 12067 ms | 11384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define all(V) (V).begin(), (V).end()
using namespace std;
typedef vector<int> vim;
typedef pair<int, int> pii;
const int sz = 1000;
int N, M, Q, X[400010];
vector<pii> B[810]; priority_queue<int> S[810];
inline void make(int t) {
B[t].clear(); while(!S[t].empty()) S[t].pop();
int ub=min((t+1)*sz, N);
for (int i=t*sz; i<ub; i++) B[t].eb(X[i], i);
sort(all(B[t])); reverse(all(B[t]));
for (auto &i:B[t]) S[t].em(i.fi);
}
inline void upd(int t) {
for (auto &i:B[t]) { i.fi=S[t].top(); X[i.se]=i.fi; S[t].pop(); }
for (auto &i:B[t]) S[t].em(i.fi);
}
inline int sol(int t, int p) {
S[t].em(p); p=S[t].top(); S[t].pop();
Compilation message (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... |