제출 #797549

#제출 시각아이디문제언어결과실행 시간메모리
797549alvingogo커다란 상품 (IOI17_prize)C++14
컴파일 에러
0 ms0 KiB
#include "prize.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue using namespace std; map<int,vector<int> > m; int c=0,k=0; set<int> s; vector<int> query(int x){ if(m.find(x)==m.end()){ m[x]=ask(x); return m[x]; } return m[x]; } mt19937 rnd(43243214); int find_best(int n) { if(n<=5000){ for(int i=0;i<n;i++){ auto h=query(i); if(h[0]==0 && h[1]==0){ return i; } } } queue<pair<int,int> > q2; q2.push({-1,n}); int cr=0;; while(q2.size() && cr<480){ auto h=q2.front(); q2.pop(); int x=(h.fs+h.sc)/2; k=max(k,query(x)[0]+query(x)[1]); q2.push(h.fs,x); q2.push(x,h.sc); cr++; } m[-1]={0,k}; m[n]={k,0}; queue<pair<int,int> > q; q.push({-1,n}); while(q.size()){ auto h=q.front(); q.pop(); int cz=0; for(auto it=s.lower_bound(h.fs);it!=s.end() && (*it)<h.sc;it++){ cz++; } if(query(h.fs)[0]==query(h.sc)[0]-cz){ continue; } int x=(h.fs+h.sc)/2; int flag=0; for(int i=x;i>h.fs;i--){ auto y=query(i); if(y[0]+y[1]==k){ q.push({i,h.sc}); q.push({h.fs,i}); flag=1; break; } else{ s.insert(i); } } if(flag==0){ for(int i=x+1;i<h.sc;i++){ auto y=query(i); if(y[0]+y[1]==k){ q.push({i,h.sc}); flag=1; break; } else{ s.insert(i); } } } } for(auto h:s){ if(query(h)[0]==0 && query(h)[1]==0){ return h; } } return 0; }

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

prize.cpp: In function 'int find_best(int)':
prize.cpp:38:17: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)'
   38 |   q2.push(h.fs,x);
      |                 ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from prize.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note:   candidate expects 1 argument, 2 provided
prize.cpp:39:17: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(int&, int&)'
   39 |   q2.push(x,h.sc);
      |                 ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from prize.cpp:2:
/usr/include/c++/10/bits/stl_queue.h:265:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  265 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:265:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_queue.h:270:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]'
  270 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:270:7: note:   candidate expects 1 argument, 2 provided