Submission #1224431

#TimeUsernameProblemLanguageResultExecution timeMemory
1224431JerA Difficult(y) Choice (BOI21_books)C++20
0 / 100
0 ms408 KiB
#include <bits/stdc++.h>

#include "books.h"

typedef long long ll;

using namespace std;

const int MAXN = 1005;
int n, k, a;

#define get_min(b) b * k + (k * (k + 1)) / 2
#define get_max(b) b * k + a

void solve(int N, int K, long long A, int S) {
	n = N, k = K, a = A;

    int l = 1, h = n;
	ll curr;

	while (l < h){
		int m = (l + h) / 2;
		curr = skim(m);

		if (get_max(curr) < a)
			l = m + 1;
		else if (get_min(curr) > 2 * a)
			h = m - 1;
		else
		{
			vector<int> res;
			for (int i = curr; i < curr + k; i++) res.push_back(i);
			answer(res);
			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...