Submission #981127

#TimeUsernameProblemLanguageResultExecution timeMemory
981127blackslexBitaro’s Party (JOI18_bitaro)C++17
14 / 100
48 ms9440 KiB
#include<bits/stdc++.h>

using namespace std;

int n, m, q, x, y, t, r;

int main() {
    scanf("%d %d %d", &n, &m, &q);
    vector<vector<int>> v(n + 5, vector<int>());
    while (m--) scanf("%d %d", &x, &y), v[x].emplace_back(y);
    scanf("%d %d", &t, &r);
    vector<int> c(r), dp(n + 5, -1e9); dp[t] = 0;
    vector<bool> f(n + 5), f2(n + 5);
    for (auto &e: c) scanf("%d", &e), f[e] = 1;
    int ans = -1;
    for (int i = t; i >= 1; i--) {
        for (auto &e: v[i]) dp[i] = max(dp[i], dp[e] + 1);
        if (!f[i]) ans = max(ans, dp[i]);
    }
    printf("%d", ans);
}

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d %d %d", &n, &m, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:10:22: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     while (m--) scanf("%d %d", &x, &y), v[x].emplace_back(y);
      |                 ~~~~~^~~~~~~~~~~~~~~~~
bitaro.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d %d", &t, &r);
      |     ~~~~~^~~~~~~~~~~~~~~~~
bitaro.cpp:14:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     for (auto &e: c) scanf("%d", &e), f[e] = 1;
      |                      ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...