Submission #573904

#TimeUsernameProblemLanguageResultExecution timeMemory
573904moday_morningA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" #ifndef EVAL #include "grader.cpp" #endif using namespace std; map <int, long long> mp; long long all(int k, int p) { long long sum = 0; for (int i = 0; i < k; i++) { int pos = i + 1 + p; if (mp.find(pos) == mp.end()) { mp[pos] = skim(pos); } sum += mp[pos]; } return sum; } void solve(int N, int K, long long A, int S) { int l = 0, r = N - K + 1; long long left = 2 * A / K, rr = (A + K - 1) / K; while (l <= r) { int mid = (l + r) / 2; long long check = all(1, mid), check2 = all(1, mid + K - 1, 1); if (left > check) { r = mid - 1; } else if (rr < check2) { l = mid + 1; } else { if (A * 2 < all(K, mid)) { r = mid - 1; } else if (A > all(K, mid)) { l = mid + 1; } else { vector <int> st; for (int i = 0; i < K; i++) { int pos = mid + i + 1; st.push_back(pos); } answer(st); return; } } } l = K; r = N - 1; while (l <= r) { int mid = (l + r) / 2; long long check = all(K - 1, 0) + all(1, mid); if (A * 2 < check) { r = mid - 1; } else if (A > check) { l = mid + 1; } else { vector <int> st; for (int i = 0; i < K - 1; i++) { int pos = i + 1; st.push_back(pos); } st.push_back(mid + 1); answer(st); return; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:26:64: error: too many arguments to function 'long long int all(int, int)'
   26 |   long long check = all(1, mid), check2 = all(1, mid + K - 1, 1);
      |                                                                ^
books.cpp:9:11: note: declared here
    9 | long long all(int k, int p) {
      |           ^~~