Submission #245034

#TimeUsernameProblemLanguageResultExecution timeMemory
245034vioalbertCollecting Stamps 3 (JOI20_ho_t3)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll N = 205; ll n, l; ll cl[N], ccl[N], t[N]; void read() { cin >> n >> l; cl[0] = ccl[0] = 0; for(int i = 1; i <= n; i++) { cin >> cl[i]; ccl[i] = l - cl[i]; } for(int i = 1; i <= n; i++) cin >> t[i]; } struct state { int l, r, cnt; bool dir; bool operator<(const state& ot) const { return cnt < ot.cnt; } }; void solve() { priority_queue<pair<ll, state>, vector<pair<ll, state>>, greater<pair<ll, state>>> pq; ll dist[n+2][n+2][n+2][2]; bool vis[n+2][n+2][n+2][2]; memset(dist, -1, sizeof dist); memset(vis, 0, sizeof vis); int ans = 0; pq.emplace(0, {1, n, 0, 0}); dist[1][n][0][0] = 0; while(!pq.empty()) { state u = pq.top().second; pq.pop(); if(!vis[u.l][u.r][u.cnt][u.dir]) { vis[u.l][u.r][u.cnt][u.dir] = 1; // cerr << u.l << ' ' << u.r << ' ' << u.cnt << ' ' << u.dir << '\n'; // cerr << dist[u.l][u.r][u.cnt][u.dir] << '\n'; if(u.l > u.r) { ans = max(ans, u.cnt); continue; } ll cost, total; if(u.dir == 0) { cost = ((u.l==1)?0:-cl[u.l-1]) + cl[u.l]; total = dist[u.l][u.r][u.cnt][u.dir] + cost; ll& nxt1 = dist[u.l+1][u.r][u.cnt + (total <= t[u.l])][0]; if(nxt1 == -1 || nxt1 > total) { nxt1 = total; pq.emplace(nxt1, {u.l+1, u.r, u.cnt + (total <= t[u.l]), 0}); } cost = ((u.l==1)?0:cl[u.l-1]) + ccl[u.r]; total = dist[u.l][u.r][u.cnt][u.dir] + cost; ll& nxt2 = dist[u.l][u.r-1][u.cnt + (total <= t[u.r])][1]; if(nxt2 == -1 || nxt2 > total) { nxt2 = total; pq.emplace(nxt2, {u.l, u.r-1, u.cnt + (total <= t[u.r]), 1}); } } else { cost = ((u.r==n)?0:-ccl[u.r+1]) + ccl[u.r]; total = dist[u.l][u.r][u.cnt][u.dir] + cost; ll& nxt1 = dist[u.l][u.r-1][u.cnt + (total <= t[u.r])][1]; if(nxt1 == -1 || nxt1 > total) { nxt1 = total; pq.emplace(nxt1, {u.l, u.r-1, u.cnt + (total <= t[u.r]), 1}); } cost = ((u.r==n)?0:ccl[u.r+1]) + cl[u.l]; total = dist[u.l][u.r][u.cnt][u.dir] + cost; ll& nxt2 = dist[u.l+1][u.r][u.cnt + (total <= t[u.l])][0]; if(nxt2 == -1 || nxt2 > total) { nxt2 = total; pq.emplace(nxt2, {u.l+1, u.r, u.cnt + (total <= t[u.l]), 0}); } } } } cout << ans << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0); read(); solve(); return 0; }

Compilation message (stderr)

ho_t3.cpp: In function 'void solve()':
ho_t3.cpp:34:28: error: no matching function for call to 'std::priority_queue<std::pair<long long int, state>, std::vector<std::pair<long long int, state> >, std::greater<std::pair<long long int, state> > >::emplace(int, <brace-enclosed initializer list>)'
  pq.emplace(0, {1, n, 0, 0});
                            ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ho_t3.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:611:2: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {}; _Tp = std::pair<long long int, state>; _Sequence = std::vector<std::pair<long long int, state> >; _Compare = std::greater<std::pair<long long int, state> >]
  emplace(_Args&&... __args)
  ^~~~~~~
/usr/include/c++/7/bits/stl_queue.h:611:2: note:   candidate expects 0 arguments, 2 provided
ho_t3.cpp:54:65: error: no matching function for call to 'std::priority_queue<std::pair<long long int, state>, std::vector<std::pair<long long int, state> >, std::greater<std::pair<long long int, state> > >::emplace(ll&, <brace-enclosed initializer list>)'
      pq.emplace(nxt1, {u.l+1, u.r, u.cnt + (total <= t[u.l]), 0});
                                                                 ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ho_t3.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:611:2: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {}; _Tp = std::pair<long long int, state>; _Sequence = std::vector<std::pair<long long int, state> >; _Compare = std::greater<std::pair<long long int, state> >]
  emplace(_Args&&... __args)
  ^~~~~~~
/usr/include/c++/7/bits/stl_queue.h:611:2: note:   candidate expects 0 arguments, 2 provided
ho_t3.cpp:62:65: error: no matching function for call to 'std::priority_queue<std::pair<long long int, state>, std::vector<std::pair<long long int, state> >, std::greater<std::pair<long long int, state> > >::emplace(ll&, <brace-enclosed initializer list>)'
      pq.emplace(nxt2, {u.l, u.r-1, u.cnt + (total <= t[u.r]), 1});
                                                                 ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ho_t3.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:611:2: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {}; _Tp = std::pair<long long int, state>; _Sequence = std::vector<std::pair<long long int, state> >; _Compare = std::greater<std::pair<long long int, state> >]
  emplace(_Args&&... __args)
  ^~~~~~~
/usr/include/c++/7/bits/stl_queue.h:611:2: note:   candidate expects 0 arguments, 2 provided
ho_t3.cpp:70:65: error: no matching function for call to 'std::priority_queue<std::pair<long long int, state>, std::vector<std::pair<long long int, state> >, std::greater<std::pair<long long int, state> > >::emplace(ll&, <brace-enclosed initializer list>)'
      pq.emplace(nxt1, {u.l, u.r-1, u.cnt + (total <= t[u.r]), 1});
                                                                 ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ho_t3.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:611:2: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {}; _Tp = std::pair<long long int, state>; _Sequence = std::vector<std::pair<long long int, state> >; _Compare = std::greater<std::pair<long long int, state> >]
  emplace(_Args&&... __args)
  ^~~~~~~
/usr/include/c++/7/bits/stl_queue.h:611:2: note:   candidate expects 0 arguments, 2 provided
ho_t3.cpp:78:65: error: no matching function for call to 'std::priority_queue<std::pair<long long int, state>, std::vector<std::pair<long long int, state> >, std::greater<std::pair<long long int, state> > >::emplace(ll&, <brace-enclosed initializer list>)'
      pq.emplace(nxt2, {u.l+1, u.r, u.cnt + (total <= t[u.l]), 0});
                                                                 ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ho_t3.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:611:2: note: candidate: void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {}; _Tp = std::pair<long long int, state>; _Sequence = std::vector<std::pair<long long int, state> >; _Compare = std::greater<std::pair<long long int, state> >]
  emplace(_Args&&... __args)
  ^~~~~~~
/usr/include/c++/7/bits/stl_queue.h:611:2: note:   candidate expects 0 arguments, 2 provided