제출 #722011

#제출 시각아이디문제언어결과실행 시간메모리
722011saayan007Bitaro’s Party (JOI18_bitaro)C++17
14 / 100
2097 ms10480 KiB
#include "bits/stdc++.h"
using namespace std;

#define int long long
#define fr first
#define sc second
#define eb emplace_back
#define nl "\n"

#warning N, Q are same but M is different
const int N = 1e5L + 1;
int n, m, q;
vector<int> adj[N];
int dp[N];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> m >> q;
    for(int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        adj[a].eb(b);
    }

    while(q--) {
        int t, y;
        vector<int> c;
        cin >> t >> y;
        c.resize(y + 1);
        c[0] = 0;
        for(int i = 1; i <= y; ++i) cin >> c[i];

        int ans = -1;
        for(int i = t; i > 0; --i) {
            while(c.back() > i) c.pop_back();

            dp[i] = -1;
            for(auto u : adj[i])
                if(u <= t && dp[u] != -1)
                    dp[i] = max(dp[i], dp[u] + 1);
            if(i == t) dp[i] = 0;

            if(c.back() != i)
                ans = max(ans, dp[i]);
        }
        /* for(int i = 1; i <= n; ++i) cout << (i > t ? -1 : dp[i]) << ' ';cout << nl; */
        cout << ans << nl;
        /* cout << nl; */
    }

}

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

bitaro.cpp:10:2: warning: #warning N, Q are same but M is different [-Wcpp]
   10 | #warning N, Q are same but M is different
      |  ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...