Submission #810651

#TimeUsernameProblemLanguageResultExecution timeMemory
810651MyCodeA Difficult(y) Choice (BOI21_books)C++17
5 / 100
170 ms1068 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int n, int k, long long A, int s) { long long a[n + 1]; for (int i = 1; i <= n; i++) a[i] = skim(i); for (int i = 1; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { long long sum = a[i] + a[j]; if (sum > 2 * A) continue; int l = j + 1, r = n; while (r - l > 1) { int m = (l + r) >> 1; if (a[m] >= A - sum) r = m; else l = m; } int ind = -1; if (a[l] >= A - sum) ind = l; else if (a[r] >= A - sum) ind = r; if (ind != -1 && sum + a[ind] <= 2 * A) { answer({i, j, ind}); 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...