Submission #574801

#TimeUsernameProblemLanguageResultExecution timeMemory
574801RealSnakeA Difficult(y) Choice (BOI21_books)C++14
0 / 100
2 ms1060 KiB
#include "bits/stdc++.h" using namespace std; #include "books.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define ll long long #define mod 1000000007 void solve(int n, int k, ll A, int S) { // n <= 1000, s = n, k = 3; ll arr[n + 1]; for(int i = 1; i <= n; i++) arr[i] = skim(i); vector<int> ans; set<ll> s; for(int i = n; i >= 0; i--) { for(int j = i - 1; j >= 0; j--) { ll sum = arr[i] + arr[j]; auto it = s.lower_bound(A - sum); if(it != s.end()) { sum += *it; if(sum <= 2 * A) { ans.push_back(i); ans.push_back(j); ans.push_back(*it); answer(ans); return; } } } s.insert(arr[i]); } 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...