Submission #406221

#TimeUsernameProblemLanguageResultExecution timeMemory
406221maomao90A Difficult(y) Choice (BOI21_books)C++17
5 / 100
241 ms492 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]; void solve(int n, int k, ll a, int s) { REP (i, 1, n + 1) { x[i] = skim(i); } REP (i, 1, n + 1) { REP (j, i + 1, n + 1) { ll tmp = x[i] + x[j]; ll rem = 2 * a - tmp; if (rem <= 0) continue; int lower = upper_bound(x + 1, x + n + 1, rem) - x - 1; if (lower == 0) continue; while (lower == i || lower == j) lower--; if (lower <= 0) continue; if (x[i] + x[j] + x[lower] >= a) { vi ans = {i, j, lower}; answer(ans); return; } } } 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...