제출 #1009201

#제출 시각아이디문제언어결과실행 시간메모리
1009201alexddA Difficult(y) Choice (BOI21_books)C++17
0 / 100
3056 ms344 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; map<int,int> mp; int ramase; int query(int 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; int st=1,dr=N-K+1; while(st<=dr) { int mij=(st+dr)/2; if(exact(mij,K)>=A) { if(exact(mij,K)<=2*A) { vector<int> sol; for(int i=mij;i<mij+K;i++) sol.push_back(i); answer(sol); return; } dr = mij-1; } else st = mij+1; } while(1); 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...