Submission #574989

#TimeUsernameProblemLanguageResultExecution timeMemory
574989RealSnakeA Difficult(y) Choice (BOI21_books)C++14
0 / 100
11 ms1056 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) {
    // s = n;
    ll arr[n + 1];
    for(int i = 1; i <= n; i++)
        arr[i] = skim(i);
    for(int i = 1; i <= n; i++) {
        int j = i, y = 0;
        ll sum = 0;
        while(j <= n && y < k) {
            sum += arr[j];
            j += 2;
            y++;
        }
        if(y == k && sum >= a && sum <= 2 * a) {
            vector<int> ans;
            j = i, y = 0;
            while(j <= n && y < k) {
                ans.push_back(j);
                j += 2;
                y++;
            }
            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...