Submission #483973

#TimeUsernameProblemLanguageResultExecution timeMemory
483973BERNARB01A Difficult(y) Choice (BOI21_books)C++17
0 / 100
3 ms304 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; const int N = (int) 1e5 + 9; int n, k, s; long long a[N], lo, hi; void solve(int nn, int K, long long A, int S) { lo = A; hi = 2 * A; n = nn; k = K; s = S; for (int i = 0; i < n; i++) { a[i] = skim(i + 1); if (a[i] >= lo) { n = i + 1; break; } } map<long long, int> id; for (int i = 0; i < n; i++) { id[a[i]] = i; } for (int i = 0; i < n; i++) { set<long long> se; for (int j = n - 1; j > i; j--) { long long sum = a[i] - a[j]; auto it = se.lower_bound(lo - sum); if (it == se.end()) { continue; } if (sum + *it <= hi) { answer({i, j, id[*it]}); } se.insert(a[j]); } } 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...