Submission #446906

#TimeUsernameProblemLanguageResultExecution timeMemory
446906wiwihoA Difficult(y) Choice (BOI21_books)C++14
10 / 100
4 ms1044 KiB
#include <bits/stdc++.h> #include "books.h" #define eb emplace_back #define mp make_pair #define F first #define S second #define iter(a) a.begin(), a.end() #define lsort(a) sort(iter(a)) using namespace std; typedef long long ll; const ll MAX = 1LL << 60; using pii = pair<int, int>; void ans(int st, int k){ vector<int> v(k); for(int i = 0; i < k; i++) v[i] = st + i; answer(v); } vector<ll> x; ll query(int i){ if(x[i] == -1) x[i] = skim(i); return x[i]; } ll qrange(int l, int r){ ll sum = 0; for(int i = l; i <= r; i++) sum += query(i); return sum; } void solve(int n, int k, ll A, int S){ x.resize(n + 1, -1); int l = 1, r = n - k + 1; while(l < r){ int m = (l + r) / 2; if(qrange(m, m + k - 1) < A) l = m + 1; else r = m; } ll sum = qrange(l, l + k - 1); if(sum > 2 * A || sum < A) impossible(); ans(l, k); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...