Submission #567246

#TimeUsernameProblemLanguageResultExecution timeMemory
567246birthdaycakeBitaro’s Party (JOI18_bitaro)C++17
0 / 100
6 ms9812 KiB
#include<bits/stdc++.h> #define endl '\n' #define int long long #define mod 1000000007 #define boost ios_base::sync_with_stdio(false), cin.tie(NULL); using namespace std; vector<int>adj[200001],radj[200001]; int no[200001],dis[200001],dg[200001],rdg[200001]; signed main(){ boost; int n,m,q; cin >> n >> m >> q; for(int i = 0; i < m; i++){ int a,b; cin >> a >> b; adj[a].push_back(b); radj[b].push_back(a); dg[a]++; rdg[a] = dg[a]; } while(q--){ int t,y, ans = -1; cin >> t >> y; for(int i = 1; i <= n; i++) { no[i] = 0; dis[i] = 0; dg[i] = rdg[i]; } for(int i = 0; i < y; i++){ int x; cin >> x; no[x] = 1; } vector<int>x = {t}; for(int i = 0; i < x.size(); i++){ int k = x[i]; if(!no[k]) ans = max(ans,dis[k]); for(auto s: radj[k]){ dg[s]--; dis[s] = max(dis[s], dis[k] + 1); if(dg[s] == 0) x.push_back(s); } } cout << ans << endl; } return 0; }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:38:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(int i = 0; i < x.size(); i++){
      |                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...