제출 #62355

#제출 시각아이디문제언어결과실행 시간메모리
62355gusfringBitaro’s Party (JOI18_bitaro)C++14
14 / 100
2020 ms6780 KiB
#include <cstdio>
#include <vector>
using namespace std;
 
vector<int> al[100009];
int dp[100009];
bool busy[100009];
 
int main(){
    int N, M, Q;
    scanf("%d %d %d", &N, &M, &Q);
    for (int i = 0; i < M; i++){
        int s, e;
        scanf("%d %d", &s, &e);
        al[s].push_back(e);
    }
    for (int q = 0; q < Q; q++){
        int t,  y;
        scanf("%d %d", &t, &y);
        for (int i = 0; i < y; i++){
            int x;
            scanf("%d", &x);
            busy[x] = true;
        }
        int ans = -1;
        dp[t] = 0;
        if (!busy[t]) ans = 0;
        for (int i = t-1; i >= 1; i--){
            dp[i] = -1;
            for (vector<int>::iterator j = al[i].begin(); j != al[i].end(); j++){
                if (*j <= t && dp[*j] != -1) dp[i] = max(dp[i], dp[*j]+1);
            }
            if (!busy[i]) ans = max(ans,dp[i]);
        }
        printf("%d\n", ans);
        for (int i = 1; i <= N; i++) busy[i] = false;
    }
}

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

bitaro.cpp: In function 'int main()':
bitaro.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &N, &M, &Q);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
bitaro.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &s, &e);
         ~~~~~^~~~~~~~~~~~~~~~~
bitaro.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &t, &y);
         ~~~~~^~~~~~~~~~~~~~~~~
bitaro.cpp:22:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...