Submission #412645

#TimeUsernameProblemLanguageResultExecution timeMemory
412645cfalasA Difficult(y) Choice (BOI21_books)C++14
0 / 100
5 ms456 KiB
#include<bits/stdc++.h> using namespace std; #define mp make_pair #define INF 10000000 #define MOD 1000000007 #define MID ((l+r)/2) #define HASHMOD 2305843009213693951 #define ll long long #define ull unsigned long long #define F first #define S second typedef pair<ll, ll> ii; typedef pair<ii, int> iii; typedef vector<ll> vi; typedef vector<ii> vii; typedef map<int, int> mii; #define EPS 1e-6 #define FOR(i,n) for(int i=0;i<((int)(n));i++) #define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++) #define FOA(v, a) for(auto v : a) #include "books.h" using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // ll a[10000000]; ll q(int x){ if(a[x]) return a[x]; a[x] = skim(x); return a[x]; } void solve(int n, int K, long long A, int S) { assert(S>=n); // cons int l=1, r=n-K+1; while(l<=r){ ll s=0; FORi(i,MID, MID+K) s+= q(i); if(A<=s && s<=2*A){ vector<int> ans; FORi(i,MID, MID+K) ans.push_back(i); answer(ans); } else if(s<A) l = MID+1; else r = MID-1; } ll s=0; FOR(i,K-1) s+=q(i+1); l=K, r=n; while(l<=r){ //cout<<MID<<" "<<s+q(MID)<<endl; if(A<=s+q(MID) && s+q(MID)<=2*A){ vector<int> ans; FOR(i,K-1) ans.push_back(i+1); ans.push_back(MID); answer(ans); } else if(s+MID<A) l = MID+1; else r = MID-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...