제출 #821008

#제출 시각아이디문제언어결과실행 시간메모리
821008vjudge1커다란 상품 (IOI17_prize)C++17
컴파일 에러
0 ms0 KiB
//#include "prize.h" #include <bits/stdc++.h> using namespace std; int find_best(int n){ int mx = -1 , i , j , m , s , f , l , r , k , c , y , x; #define pb push_back() #define all(a) (a.begin() , a.end()) vector<pair<int,int>>vc , v; for(i = 0; i < min(n, 1000); i++){ vector<int>gt = ask(i); vc.pb({gt[0] + gt[1] , i}); if(gt[0] + gt[1] > mx) mx = gt[0] + gt[1] , x = gt[0] , k = i; } sort(all(vc)); for(auto to : v) if(to.fi != mx) v.pb({to.fi , to.se}); while(k < n){ l = k; r = n - 1; while(l != r){ m = (l + r + 1) / 2; vector<int>gt = ask(m); ll sum = gt[0] + gt[1]; if(sum == mx && (gt[0] - k) == (m - x)){ l = m; }else { r = m - 1; } } k = l + 1; while(k < n){ vector<int>gt = ask(k); ll sum = gt[0] + gt[1]; x = gt[0]; if(sum < mx){ v.pb({sum , k}); }else { break; } k++; } } sort(all(v)); return v[0].se; } void solve(){ ll q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn = 1e18 , mx = 0; } int main(){ TL; /* #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif */ int t = 1; //cin>>t; while(t--) { solve(); } } // Author : حسن

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:16:25: error: 'ask' was not declared in this scope
   16 |         vector<int>gt = ask(i);
      |                         ^~~
prize.cpp:12:26: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back()'
   12 |     #define pb push_back()
      |                          ^
prize.cpp:17:12: note: in expansion of macro 'pb'
   17 |         vc.pb({gt[0] + gt[1] , i});
      |            ^~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 0 provided
prize.cpp:21:17: error: no matching function for call to 'sort(std::vector<std::pair<int, int> >::iterator)'
   21 |     sort(all(vc));
      |                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:4849:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4849 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4849:5: note:   template argument deduction/substitution failed:
prize.cpp:21:17: note:   candidate expects 2 arguments, 1 provided
   21 |     sort(all(vc));
      |                 ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4880:5: note:   template argument deduction/substitution failed:
prize.cpp:21:17: note:   candidate expects 3 arguments, 1 provided
   21 |     sort(all(vc));
      |                 ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note:   template argument deduction/substitution failed:
prize.cpp:21:17: note:   candidate expects 4 arguments, 1 provided
   21 |     sort(all(vc));
      |                 ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
prize.cpp:21:17: note:   candidate expects 3 arguments, 1 provided
   21 |     sort(all(vc));
      |                 ^
prize.cpp:23:15: error: 'struct std::pair<int, int>' has no member named 'fi'
   23 |         if(to.fi != mx)
      |               ^~
prize.cpp:12:26: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back()'
   12 |     #define pb push_back()
      |                          ^
prize.cpp:24:15: note: in expansion of macro 'pb'
   24 |             v.pb({to.fi , to.se});
      |               ^~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 0 provided
prize.cpp:24:22: error: 'struct std::pair<int, int>' has no member named 'fi'
   24 |             v.pb({to.fi , to.se});
      |                      ^~
prize.cpp:24:30: error: 'struct std::pair<int, int>' has no member named 'se'
   24 |             v.pb({to.fi , to.se});
      |                              ^~
prize.cpp:30:29: error: 'ask' was not declared in this scope
   30 |             vector<int>gt = ask(m);
      |                             ^~~
prize.cpp:31:13: error: 'll' was not declared in this scope; did you mean 'l'?
   31 |             ll sum = gt[0] + gt[1];
      |             ^~
      |             l
prize.cpp:32:16: error: 'sum' was not declared in this scope
   32 |             if(sum == mx && (gt[0] - k) == (m - x)){
      |                ^~~
prize.cpp:40:29: error: 'ask' was not declared in this scope
   40 |             vector<int>gt = ask(k);
      |                             ^~~
prize.cpp:41:13: error: 'll' was not declared in this scope; did you mean 'l'?
   41 |             ll sum = gt[0] + gt[1];
      |             ^~
      |             l
prize.cpp:43:16: error: 'sum' was not declared in this scope
   43 |             if(sum < mx){
      |                ^~~
prize.cpp:12:26: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back()'
   12 |     #define pb push_back()
      |                          ^
prize.cpp:44:19: note: in expansion of macro 'pb'
   44 |                 v.pb({sum , k});
      |                   ^~
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 0 provided
prize.cpp:51:16: error: no matching function for call to 'sort(std::vector<std::pair<int, int> >::iterator)'
   51 |     sort(all(v));
      |                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:4849:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)'
 4849 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4849:5: note:   template argument deduction/substitution failed:
prize.cpp:51:16: note:   candidate expects 2 arguments, 1 provided
   51 |     sort(all(v));
      |                ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/bits/stl_algo.h:4880:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'
 4880 |     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
      |     ^~~~
/usr/include/c++/10/bits/stl_algo.h:4880:5: note:   template argument deduction/substitution failed:
prize.cpp:51:16: note:   candidate expects 3 arguments, 1 provided
   51 |     sort(all(v));
      |                ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)'
  292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:292:1: note:   template argument deduction/substitution failed:
prize.cpp:51:16: note:   candidate expects 4 arguments, 1 provided
   51 |     sort(all(v));
      |                ^
In file included from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from prize.cpp:3:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)'
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:296:1: note:   template argument deduction/substitution failed:
prize.cpp:51:16: note:   candidate expects 3 arguments, 1 provided
   51 |     sort(all(v));
      |                ^
prize.cpp:52:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'se'
   52 |     return v[0].se;
      |                 ^~
prize.cpp:11:23: warning: unused variable 'j' [-Wunused-variable]
   11 |     int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                       ^
prize.cpp:11:31: warning: unused variable 's' [-Wunused-variable]
   11 |     int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                               ^
prize.cpp:11:35: warning: unused variable 'f' [-Wunused-variable]
   11 |     int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                   ^
prize.cpp:11:51: warning: unused variable 'c' [-Wunused-variable]
   11 |     int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                                   ^
prize.cpp:11:55: warning: unused variable 'y' [-Wunused-variable]
   11 |     int mx = -1 , i , j , m , s , f , l , r , k , c , y , x;
      |                                                       ^
prize.cpp: In function 'void solve()':
prize.cpp:56:5: error: 'll' was not declared in this scope; did you mean 'all'?
   56 |     ll q , i , j , m ,n, z ,s = 0 , f , l , r , k , x , y , mn  = 1e18 , mx = 0;
      |     ^~
      |     all
prize.cpp: In function 'int main()':
prize.cpp:62:6: error: 'TL' was not declared in this scope
   62 |      TL;
      |      ^~