Submission #969137

#TimeUsernameProblemLanguageResultExecution timeMemory
969137Onur_IlgazA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" #include <bits/stdc++.h> #define int long long #define inf ((int)1e18) using namespace std; void solve(int N, int K, long long A, int S) { vector <int> res(N + 1); int l = 0, r = N + 1; while(r - l > 1) { int m = (l + r) / 2; if((res[m] = skim(m)) >= A) { r = m; } else { l = m; } } int ind = r; // first way int sum = 0; for(int i = 1; i <= K; i++) { if(!res[i]) res[i] = skim(i); sum += res[i]; if(i == K - 1 and ind <= N and res[ind] + sum <= 2 * A) { vector <int> ans; for(int i = 1; i < K; i++) { ans.push_back(i); } ans.push_back(ind); answer(ans); return; } } for(int i = ind - K; i < ind; i++) { if(!res[i]) res[i] = skim(i); } for(int i = 1; i <= K; i++) { if(sum >= A) { // print vector <int> ans; for(int j = i; j <= K; j++) ans.push_back(j); for(int j = 1; j < i; j++) ans.push_back(ind - j); answer(ans); return; } sum -= res[i]; sum += res[ind - i]; } }

Compilation message (stderr)

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