이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// In the name of Allah
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
typedef long long int	ll;
typedef long double	ld;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
#define all(x)		(x).begin(),(x).end()
#define len(x)		((ll) (x).size())
#define F		first
#define S		second
#define pb		push_back
#define sep             ' '
#define endl            '\n'
#define Mp		make_pair
#define debug(x)	cerr << #x << ": " <<  x << endl;
#define kill(x)		cout << x << '\n', exit(0)
#define set_dec(x)	cout << fixed << setprecision(x);
#define file_io(x,y)	freopen(x, "r", stdin); freopen(y, "w", stdout);
void answerx(set<int> res) {
	vector<int> vc;
	for (int i : res) vc.pb(i);
	answer(vc);
}
void solve(int N, int K, ll A, int S) {
	ll arr[N + 1]; set<int> res;
	
	ll sm = 0;
	for (int i = 1; i <= K; i++) {
		arr[i] = skim(i); sm += arr[i];
		res.insert(i);
	}
	
	if (sm >= A && sm <= 2 * A) {
		answerx(res); return ;
	}
	else if (sm > 2 * A) {
		impossible(); return ;
	}
	
	sm -= arr[K]; res.erase(K);
	int l = K, r = N + 1;
	while (r - l > 1) {
		int mid = (l + r) / 2;
		arr[mid] = skim(mid);
		
		if (sm + arr[mid] <= 2 * A) l = mid;
		else r = mid;
	}
	sm += arr[l]; res.insert(l);
	
	int i = K - 1, j = l - 1;
	while (i >= 1 && (sm < A || sm > 2 * A)) {
		sm -= arr[i]; res.erase(i); i--;
		sm += arr[j]; res.insert(j); j--;
	}
	
	if (sm >= A && sm <= 2 * A) {
		answerx(res); return ;
	}
	else {
		impossible(); return ;
	}
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |