Submission #406243

#TimeUsernameProblemLanguageResultExecution timeMemory
406243maomao90A Difficult(y) Choice (BOI21_books)C++17
20 / 100
320 ms712 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; #define mnto(x, y) x = min(x, (__typeof__(x)) y) #define mxto(x, y) x = max(x, (__typeof__(x)) y) #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb emplace_back typedef vector<int> vi; typedef vector<ii> vii; #define INF 1000000005 #define LINF 1000000000000000005 #define MOD 1000000007 #define MAXN 100005 ll x[MAXN]; int todo[MAXN]; bool used[MAXN]; void solve(int n, int k, ll a, int s) { REP (i, 1, n + 1) { x[i] = skim(i); } ll sum = 0; REP (i, 1, k + 1) { todo[i] = i; sum += x[i]; } RREP (i, k, 1) { while (!used[todo[i] + 1] && todo[i] < n && sum - x[todo[i]] + x[todo[i] + 1] <= 2 * a) { sum = sum - x[todo[i]] + x[todo[i] + 1]; todo[i]++; } used[todo[i]] = 1; if (sum >= a && sum <= 2 * a) { vi ans; REP (i, 1, k + 1) { ans.pb(todo[i]); } answer(ans); } } impossible(); return; }
#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...