Submission #573694

#TimeUsernameProblemLanguageResultExecution timeMemory
573694moday_morningA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define int long long #include "books.h" using namespace std; map <int, int> mp; int all(int k, int p) { int sum = 0; for (int i = 0; i < k; i++) { if (mp.find(i + 1 + p) == mp.end()) { mp[i + 1 + p] = skim(i + 1 + p); sum += mp[i + 1 + p]; } } } void solve(int N, int K, long long A, int S) { int l = 0, r = N - K - 1, ll = 2 * A / K. rr = (K + 1 + A) / K; while (l <= r) { int mid = (l + r) / 2, lll = all(1, mid), rrr = all(1, k - 1 + mid); if (ll < lll) { r = mid; } else if (rr < rrr) { l = mid; } else { int border = all(K, mid); if (A * 2 > all(K, mid)) { r = mid - 1; } else if (A > all(K, mid)) { l = mid + 1; } else { stack <int> st; for (int i = 0; i < K; i++) { int pos = mid + i + 1; st.push(pos); } answer(st); return; } } } l = K; r = N - 1; while (l <= r) { int mid = (l + r) / 2; if (A * 2 > (all(K - 1, 0) + all(mid, 1))) { r = mid - 1; } else if (A < (all(K - 1, 0) + all(mid, 1))) { l = mid - 1; } else { stack <int> st; for (int i = 0; i < K - 1; i++) { int pos = i + 1; st.push(pos); } st.push(mid + 1); answer(st); return; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'long long int all(long long int, long long int)':
books.cpp:16:1: warning: no return statement in function returning non-void [-Wreturn-type]
   16 | }
      | ^
books.cpp: In function 'void solve(long long int, long long int, long long int, long long int)':
books.cpp:19:44: error: request for member 'rr' in 'K', which is of non-class type 'long long int'
   19 |  int l = 0, r = N - K - 1, ll = 2 * A / K. rr = (K + 1 + A) / K;
      |                                            ^~
books.cpp:21:59: error: 'k' was not declared in this scope
   21 |   int mid = (l + r) / 2, lll = all(1, mid), rrr =  all(1, k - 1 + mid);
      |                                                           ^
books.cpp:25:12: error: 'rr' was not declared in this scope; did you mean 'rrr'?
   25 |   else if (rr < rrr) {
      |            ^~
      |            rrr
books.cpp:42:12: error: could not convert 'st' from 'std::stack<long long int>' to 'std::vector<long long int>'
   42 |     answer(st);
      |            ^~
      |            |
      |            std::stack<long long int>
books.cpp:29:8: warning: unused variable 'border' [-Wunused-variable]
   29 |    int border = all(K, mid);
      |        ^~~~~~
books.cpp:64:11: error: could not convert 'st' from 'std::stack<long long int>' to 'std::vector<long long int>'
   64 |    answer(st);
      |           ^~
      |           |
      |           std::stack<long long int>