Submission #334475

#TimeUsernameProblemLanguageResultExecution timeMemory
334475trthminhBitaro’s Party (JOI18_bitaro)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define rep(i, a, b) for(ll i = (a); i <= (b); ++i) #define req(i, a, b) for(ll i = (a); i >= (b); --i) #define name "bitaro" #define pb emplace_back #define sz size() #define ff first #define ss second typedef pair < int, int > ii; const int maxn = 1e5 + 7, oo = 1e9, mod = 1e9 + 7, can = 100; int n, m, q, x, y, busy[maxn], b[maxn], s, cnt, f[maxn]; vector < int > a[maxn], aa[maxn]; vector < ii > furthest[maxn]; void pre() { rep (i, 1, n) { vector < ii > tmp; for (int j : a[i]) for (auto k : furthest[j]) tmp.pb({k.ff + 1, k.ss}); tmp.pb({0, i}); sort(tmp.begin(), tmp.end(), greater < ii > ()); for (auto j : tmp) { if (busy[j.ss] == 0) { busy[j.ss] = 1; furthest[i].pb(j); if (furthest[i].sz == can) break; } } for (auto j : furthest[i]) busy[j.ss] = 0; } } void solve2() { int res = -1; for (auto i : furthest[s]) if (!busy[i.ss]) res = max (res, i.ff); cout << res << '\n'; } void solve1() { rep (i, 1, n) f[i] = -oo; f[s] = 0; for (int i = s - 1; i >= 1; --i) for (int j : aa[i]) f[i] = max (f[i], f[j] + 1); int res = -1; rep (i, 1, s) if (!busy[i]) res = max (res, f[i]); cout << res << '\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); //freopen(name".inp", "r", stdin); //freopen(name".out", "w", stdout); cin >> n >> m >> q; rep (i, 1, m) { cin >> x >> y; a[y].pb(x); aa[x].pb(y); } pre(); while (q--) { cin >> s >> cnt; rep (i, 1, cnt) { cin >> b[i]; busy[b[i]] = 1; } if (cnt >= can) solve1(); else solve2(); rep (i, 1, cnt) busy[b[i]] = 0; } }

Compilation message (stderr)

bitaro.cpp: In function 'void pre()':
bitaro.cpp:23:40: error: no matching function for call to 'std::vector<std::pair<int, int> >::emplace_back(<brace-enclosed initializer list>)'
   23 |                 tmp.pb({k.ff + 1, k.ss});
      |                                        ^
In file included from /usr/include/c++/9/vector:72,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/vector.tcc:109:7: note: candidate: 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {}; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  109 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/vector.tcc:109:7: note:   candidate expects 0 arguments, 1 provided
bitaro.cpp:24:22: error: no matching function for call to 'std::vector<std::pair<int, int> >::emplace_back(<brace-enclosed initializer list>)'
   24 |         tmp.pb({0, i});
      |                      ^
In file included from /usr/include/c++/9/vector:72,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from bitaro.cpp:1:
/usr/include/c++/9/bits/vector.tcc:109:7: note: candidate: 'void std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {}; _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  109 |       vector<_Tp, _Alloc>::
      |       ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/vector.tcc:109:7: note:   candidate expects 0 arguments, 1 provided