제출 #834688

#제출 시각아이디문제언어결과실행 시간메모리
834688HaroldVemeno쌀 창고 (IOI11_ricehub)C++17
100 / 100
11 ms1816 KiB
#include "ricehub.h" #include <bits/stdc++.h> #ifdef GUDEB #define D(x) cerr << #x << ": " << (x) << '\n'; #define ifdeb if(true) #else #define D(x) ; #define ifdeb if(false) #endif #define all(x) begin(x), end(x) using namespace std; using ull = unsigned long long; using ll = long long; // #define int ll; int besthub(int R, int L, int X[], long long B) { int l = 0; int m = 0; int r = 0; ll c = 0; int best = 1; while(r < R) { ++r; c += X[r-1] - X[m]; D(l) D(m) D(r) D(c) while(m < (l+r)/2) { c += 1ll*(X[m+1] - X[m])*(2*m-l-r+2); ++m; } while(c > B) { c -= X[m] - X[l]; ++l; while(m < (l+r)/2) { c += 1ll*(X[m+1] - X[m])*(2*m-l-r+2); ++m; } } best = max(best, r-l); } return best; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...