제출 #575045

#제출 시각아이디문제언어결과실행 시간메모리
575045RealSnakeA Difficult(y) Choice (BOI21_books)C++14
0 / 100
11 ms976 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) { ll arr[n + 1]; for(int i = 1; i <= n; i++) arr[i] = skim(i); bool b[n + 1] = {}; ll sum = 0; for(int i = 1; i <= k; i++) { int ind = -1; for(int j = 1; j <= n; j++) { if(!b[j] && arr[j] >= a / (k - i + 1)) { ind = j; break; } } if(ind == -1) { for(int j = n; j >= 1; j--) { if(!b[j]) { ind = j; break; } } } sum += arr[ind]; b[ind] = 1; } if(sum >= a && sum <= 2 * a) { vector<int> ans; for(int i = 1; i <= n; i++) { if(b[i]) ans.push_back(i); } answer(ans); 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...