# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
447697 | dutch | Cake 3 (JOI19_cake3) | C++17 | 553 ms | 15048 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int LIM = 2e5, INF = 1e18;
int n, m, L, R, fVal[LIM+1], fCnt[LIM+1], pos[LIM], ans = -INF;
array<int, 2> a[LIM], b[LIM];
void add(int i, int j){
int v = a[i][1] * j; i = pos[i];
for(; i<=n; i+=i&-i){
fCnt[i] += j;
fVal[i] += v;
}
}
int get(int l, int r){
assert(r-l >= m-2);
while(R < r) add(R++, 1);
while(L > l) add(--L, 1);
while(R > r) add(--R,-1);
while(L < l) add(L++,-1);
int v = m - 2, i = 0, s = 0;
for(int j=1<<19; j/=2; ){
if(i+j <= n && fCnt[i+j] <= v){
i += j;
s += fVal[i];
v -= fCnt[i];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |