제출 #121125

#제출 시각아이디문제언어결과실행 시간메모리
121125WhipppedCreamRoller Coaster Railroad (IOI16_railroad)C++17
컴파일 에러
0 ms0 KiB
#include "railroad.h" #include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define X first #define Y second #define pb push_back typedef pair<int, int> ii; typedef long long ll; const int maxn = 18; ll dp[maxn][1<<maxn]; int n; int s[maxn], t[maxn]; const int maxN = 4e5+5; int sw[maxN]; ll solve(int u, int bit) { if(bit == (1<<n)-1) return 0; if(dp[u][bit] != -1) return dp[u][bit]; ll best = 1e18; for(int i = 0; i< n; i++) { if(bit&(1<<i)) continue; best = min(best, (t[u]<= s[i]?0:t[u]-s[i])+solve(i, bit|(1<<i))); } return dp[u][bit] = best; } ll plan_roller_coaster(vector<int> S, vector<int> T) { n = S.size(); for(int i = 0; i< n; i++) { s[i] = S[i]; t[i] = T[i]; } if(n<= 16) { memset(dp, -1, sizeof dp); ll best = 1e18; for(int i = 0; i< n; i++) best = min(best, solve(i, 1<<i)); return best; } vector<int> all; for(int i = 0; i< n; i++) { all.pb(s[i]); all.pb(t[i]); } all.pb(1); all.pb(1e9); sort(all.begin(), all.end()); all.resize(unique(all.begin(), all.end())-all.begin()); sw[0]++; sw[all.size()-1]--; for(int i = 0; i< n; i++) { int ss = lower_bound(all.begin(), all.end())-all.begin(); int tt = lower_bound(all.begin(), all.end())-all.begin(); sw[ss]--; sw[tt]++; } int run = 0; for(int i = 0; i< (int) all.size(); i++) { run += sw[i]; if(run< 0) return 12345678; } return 0; }

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

railroad.cpp: In function 'll plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:65:46: error: no matching function for call to 'lower_bound(std::vector<int>::iterator, std::vector<int>::iterator)'
   int ss = lower_bound(all.begin(), all.end())-all.begin();
                                              ^
In file included from /usr/include/c++/7/vector:60:0,
                 from railroad.h:3,
                 from railroad.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:984:5: note: candidate: template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)
     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
     ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_algobase.h:984:5: note:   template argument deduction/substitution failed:
railroad.cpp:65:46: note:   candidate expects 3 arguments, 2 provided
   int ss = lower_bound(all.begin(), all.end())-all.begin();
                                              ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from railroad.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:2023:5: note: candidate: template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)
     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
     ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_algo.h:2023:5: note:   template argument deduction/substitution failed:
railroad.cpp:65:46: note:   candidate expects 4 arguments, 2 provided
   int ss = lower_bound(all.begin(), all.end())-all.begin();
                                              ^
railroad.cpp:66:46: error: no matching function for call to 'lower_bound(std::vector<int>::iterator, std::vector<int>::iterator)'
   int tt = lower_bound(all.begin(), all.end())-all.begin();
                                              ^
In file included from /usr/include/c++/7/vector:60:0,
                 from railroad.h:3,
                 from railroad.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:984:5: note: candidate: template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)
     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
     ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_algobase.h:984:5: note:   template argument deduction/substitution failed:
railroad.cpp:66:46: note:   candidate expects 3 arguments, 2 provided
   int tt = lower_bound(all.begin(), all.end())-all.begin();
                                              ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from railroad.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:2023:5: note: candidate: template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)
     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
     ^~~~~~~~~~~
/usr/include/c++/7/bits/stl_algo.h:2023:5: note:   template argument deduction/substitution failed:
railroad.cpp:66:46: note:   candidate expects 4 arguments, 2 provided
   int tt = lower_bound(all.begin(), all.end())-all.begin();
                                              ^