Submission #1009219

#TimeUsernameProblemLanguageResultExecution timeMemory
1009219alexddA Difficult(y) Choice (BOI21_books)C++17
0 / 100
3049 ms488 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; map<long long,long long> mp; int ramase; long long query(long long x) { if(mp[x]==0) { if(ramase==0) { while(1); } ramase--; mp[x] = skim(x); } return mp[x]; } pair<long long,long long> aproximativ(int st, int K) { int dr = st+K-1; long long x = query(st); long long y = query(dr); pair<long long,long long> aux = {x+y,x+y}; for(int i=2;i<K;i++) { aux.first += x+i-1; aux.second += y-i+1; } return aux; } long long exact(int st, int K) { int dr = st+K-1; long long sum=0; for(int i=st;i<=dr;i++) sum += query(i); return sum; } void solve(int N, int K, long long A, int S) { ramase = S; /*vector<int> sol; long long sumsol=0; for(int i=N;i>0;i--) { long long x = skim(i); if(sumsol+x <= 2LL*A) { sol.push_back(i); sumsol += x; } } if(sumsol>=A && sumsol<=2LL*A) { answer(sol); return; }*/ for(int st=1;st<=N-K+1;st++) { if(exact(st,K)>=A && exact(st,K)<=2LL*A) { vector<int> sol; for(int i=st;i<st+K;i++) sol.push_back(i); answer(sol); return; } } impossible(); }
#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...