제출 #656769

#제출 시각아이디문제언어결과실행 시간메모리
656769ktkeremA Difficult(y) Choice (BOI21_books)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "books.h" typedef long long ll; typedef std::pair<ll , ll> llll; typedef std::string str; #define debug std::cout << "debug" << std::endl #define pb push_back void solve(int n , int m ,ll a , ints){ ll l = 1 , r = n; ll kp[n + 1]; memset(kp , -1 , sizeof(kp)); while(r > l){ ll md = (l+r)/2; ll z = skim(md); kp[md] = z; if(z>=a){ r = md; } else{ l=md+1; } } ll js = l; ll p = 0; ll t = 0; for(ll i = 1;m > i;i++){ if(kp[i] != -1){ t+=kp[i]; continue; } ll o = skim(i); kp[i] = o; t+=o; } ll ss = std::max(js - m , m+1); if(t + kp[js] >= a && 2 * a >= t + kp[js]){ std::vector<int> vec; for(ll i = 1;m>i;i++){ vec.pb(i); } vec.pb(js); answer(vec); return; } if(kp[m] == -1){ kp[m] = skim(m); } t+= kp[m]; if(t >= a && t<=2*a){ std::vector<int> vec; for(ll i = 1;m>=i;i++){ vec.pb(i); } answer(vec); return; } ll o = 1; while(o + ss <= js){ if(kp[o + ss - 1] == -1){ skim(o + ss -1); } t+=kp[o + ss - 1]; t-=kp[o]; if(t >= a && 2 * a >= t){ std::vector<int> vec; for(ll i = o+1;m>=i;i++){ vec.pb(i); } for(ll i = 0;o>i;i++){ vec.pb(ss + i); } answer(vec); return; } o++; } impossible(); } /*int main(){ #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif ll t = 1;std::cin >> t; while(t--){ solve(); } return 0; }*/

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

books.cpp:8:34: error: 'ints' has not been declared
    8 | void solve(int n , int m ,ll a , ints){
      |                                  ^~~~
books.cpp: In function 'void solve(int, int, ll, int)':
books.cpp:35:31: error: no matching function for call to 'max(ll, int)'
   35 |  ll ss = std::max(js - m , m+1);
      |                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
books.cpp:35:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |  ll ss = std::max(js - m , m+1);
      |                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
books.cpp:35:31: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   35 |  ll ss = std::max(js - m , m+1);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
books.cpp:35:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |  ll ss = std::max(js - m , m+1);
      |                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
books.cpp:35:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   35 |  ll ss = std::max(js - m , m+1);
      |                               ^
books.cpp:24:5: warning: unused variable 'p' [-Wunused-variable]
   24 |  ll p = 0;
      |     ^