Submission #826476

#TimeUsernameProblemLanguageResultExecution timeMemory
826476Chal1shkanA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
//Bismillahir-Rahmanir-Rahim

# include <bits/stdc++.h>
# include <books.h>

# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define all(x) (x).begin(), (x).end()
# define deb(x) cerr << #x  << " = " << x << endl; 
# define pll pair <ll, ll>
# define pii pair <int, int>
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const ll maxn = 1e5 + 7;
const ll inf = 2e18 + 0;
const ll mod = 1e9 + 7;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll arr[maxn];
ll pref[maxn];

ll get (ll x) {
	if (!arr[x]) {
		arr[x] = skim(x);
	}
	return arr[x];
}

void solve(int N, int K, long long A, int S) {
	ll sum = 0;
	for (ll i = 1; i <= K; ++i) {
		sum += get(i);
	}
	for (ll i = K; i >= 1; --i) {
		ll cur = sum - arr[i];
		ll l = K + 1, r = N, pos = -1;
		while (l <= r) {
			ll mid = (l + r) >> 1;
			if (get(mid) + cur <= 2 * A) {
				l = mid + 1;
				pos = mid;
			}
			else {
				r = mid - 1;
			}
		}
		if (pos != -1) {
			if (A <= cur + get(pos) && cur + get(pos) <= 2 * A) {
				vector <ll> ans;
				for (ll j = 1; j <= K; ++j) {
					if (j != i) {
						ans.pb(j);
					}
				}
				ans.pb(pos);
				answer(ans);
				exit(0);
			}
		}
	}
	impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:66:12: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   66 |     answer(ans);
      |            ^~~
      |            |
      |            vector<long long int>