Submission #557603

#TimeUsernameProblemLanguageResultExecution timeMemory
557603MounirA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms288 KiB
#include <bits/stdc++.h> #include "books.h" #define all(v) v.begin(), v.end() #define sz(x) (int)x.size() #define pb push_back #define pii pair<int, int> #define chmin(x, v) x = min(x, v) #define chmax(x, v) x = max(x, v) #define print(x) cout << #x << " est " << x << endl; #define x first #define y second #define int long long using namespace std; map<int, int> tmp; int getVal(int i){ if (tmp.count(i) == 0) tmp[i] = skim(i); return tmp[i]; } void solve(signed nLivres, signed aPrendre, long long borneInf, signed S) { int sum = 0; for (int i = 1; i <= aPrendre; ++i) sum += getVal(i); if (sum > 2 * borneInf) impossible(); if (sum >= borneInf){ vector<signed> ans; for (int i=1;i<=aPrendre;++i) ans.pb(i); answer(ans); } int deb = aPrendre + 1, fin = nLivres; while (fin > deb){ int mid = (fin + deb)/2; if (getVal(mid) >= borneInf) fin = mid; else deb = mid + 1; } if (getVal(deb) < borneInf) impossible(); vector<signed> ans; sum = 0; for (int i =1;i<aPrendre;++i) ans.pb(i), sum += getVal(i); ans.pb(deb); sum += getVal(deb); if (borneInf <= sum && sum <= 2 * borneInf) answer(ans); else 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...