제출 #865370

#제출 시각아이디문제언어결과실행 시간메모리
865370AlebnA Difficult(y) Choice (BOI21_books)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #define ll long long using namespace std; void solve(int n, int k, ll A, int S) { vector<ll> a(n); ll sum = 0, mid = -1; for(int i = 0; i < n; i++) { a[i] = skim(i+1); if(a[i] >= A && mid == -1) mid = i; } for(int i = 0; i < k-1; i++) sum+=a[i]; mid = min(mid, k); for(int i = mid; i > k-1; i--) { if(sum+a[mid] >= A && sum+a[mid] <= 2*A) { vector<int> b(k); for(int j = 0; j < k-1; j++) b[j] = j; b[k] = i; answer(b); } if(i == k) { impossible(); break; } } }

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:11:16: error: 'skim' was not declared in this scope
   11 |         a[i] = skim(i+1);
      |                ^~~~
books.cpp:15:21: error: no matching function for call to 'min(long long int&, int&)'
   15 |     mid = min(mid, k);
      |                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
books.cpp:15:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |     mid = min(mid, k);
      |                     ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/ostream:38,
                 from /usr/include/c++/10/iostream:39,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
books.cpp:15:21: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   15 |     mid = min(mid, k);
      |                     ^
books.cpp:21:13: error: 'answer' was not declared in this scope
   21 |             answer(b);
      |             ^~~~~~
books.cpp:24:13: error: 'impossible' was not declared in this scope
   24 |             impossible();
      |             ^~~~~~~~~~