Submission #798915

#TimeUsernameProblemLanguageResultExecution timeMemory
798915vjudge1Bitaro’s Party (JOI18_bitaro)C++17
14 / 100
2044 ms9032 KiB
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = 100100;

vector < int > adj[N], dp(N);

main() {
#ifdef Home
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // Home
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m, q, u, v;
    for(cin >> n >> m >> q; m --> 0;) {
        cin >> u >> v;
        adj[u].push_back(v);
    }
    for(int T, Y, C; q --> 0;) {
        dp.assign(n + 1, 0);
        for(cin >> T >> Y; Y --> 0;) {
            cin >> C;
            dp[C] = -N;
        }
        for(int from = 1; from < T; ++ from) {
            for(auto &to : adj[from]) {
                dp[to] = max(dp[to], dp[from] + 1);
            }
        }
        cout << max(dp[T], -1) << '\n';
    }
}

Compilation message (stderr)

bitaro.cpp:16:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   16 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...