제출 #227430

#제출 시각아이디문제언어결과실행 시간메모리
227430MKopchevBitaro’s Party (JOI18_bitaro)C++14
14 / 100
2079 ms15096 KiB
#include<bits/stdc++.h> using namespace std; const int nmax=1e5+42; vector<int> adj[nmax],bck[nmax]; int n,m,q; int sz,where; int blocked[nmax]; bool is_blocked[nmax]; int dp[nmax]; int slow() { for(int i=1;i<=n;i++) dp[i]=-1e9; dp[where]=0; for(int i=where-1;i>=1;i--) { for(auto k:adj[i]) dp[i]=max(dp[i],dp[k]+1); } int mx=-1; for(int i=where;i>=1;i--) if(is_blocked[i]==0)mx=max(mx,dp[i]); return mx; } int main() { scanf("%i%i%i",&n,&m,&q); for(int i=1;i<=m;i++) { int u,v; scanf("%i%i",&u,&v); adj[u].push_back(v); bck[v].push_back(u); } for(int i=1;i<=q;i++) { scanf("%i%i",&where,&sz); for(int j=1;j<=sz;j++) { scanf("%i",&blocked[j]); is_blocked[blocked[j]]=1; } printf("%i\n",slow()); for(int j=1;j<=sz;j++) { is_blocked[blocked[j]]=0; } } return 0; }

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

bitaro.cpp: In function 'int main()':
bitaro.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i%i",&n,&m,&q);
     ~~~~~^~~~~~~~~~~~~~~~~~~
bitaro.cpp:46:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i",&u,&v);
         ~~~~~^~~~~~~~~~~~~~
bitaro.cpp:53:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i",&where,&sz);
         ~~~~~^~~~~~~~~~~~~~~~~~~
bitaro.cpp:56:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%i",&blocked[j]);
             ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...