Submission #570455

#TimeUsernameProblemLanguageResultExecution timeMemory
570455jiahngA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> using namespace std; #include "books.h" //~ typedef long long ll; //~ #define ll int //~ #define int ll //~ typedef pair<ll, ll> pi; typedef vector <int> vi; //~ typedef vector <pi> vpi; //~ typedef pair<pi, ll> pii; //~ typedef set <ll> si; //~ typedef long double ld; //~ #define f first //~ #define s second //~ #define mp make_pair #define FOR(i,s,e) for(int i=s;i<=int(e);++i) #define DEC(i,s,e) for(int i=s;i>=int(e);--i) #define pb push_back //~ #define all(x) (x).begin(), (x).end() //~ #define lbd(x, y) lower_bound(all(x), y) //~ #define ubd(x, y) upper_bound(all(x), y) //~ #define aFOR(i,x) for (auto i: x) //~ #define mem(x,i) memset(x,i,sizeof x) //~ #define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) //~ #define maxn 1001 //~ #define INF 1e9 //~ #define MOD 998244353 //~ typedef pair <vi, int> pvi; //~ typedef pair <int,pi> ipi; //~ // // --- 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. // void solve(int N, int K, long long A, int S) { int l = 0, r = N; while (l + 1 < r){ int m = (l + r) / 2; if (skim(m) >= A) r = m; else l = m; } int x = r; //~ cout << "X: " << ' ' << x << '\n'; if (x - K >= 1 && K*skim(x-K) >= A){ vi v; FOR(i,x-K,x-1) v.pb(i); answer(v); return; } if (skim(x) <= A && x >= K){ int sm = 0; vi v; FOR(i,1,K-1){ sm += skim(i); v.pb(i); } if (sm + skim(x) <= 2*A){ v.pb(x); answer(v); 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...