Submission #200809

#TimeUsernameProblemLanguageResultExecution timeMemory
200809ekremBitaro’s Party (JOI18_bitaro)C++98
0 / 100
7 ms2808 KiB
#include <iostream> #include <set> #include <cstring> #include <vector> #include <queue> #include <stack> using namespace std; int n, m, q, x, y, k; vector<int> edges[100010]; int main(){ cin>>n>>m>>q; for (int i = 0; i < m; ++i){ cin>>x>>y; edges[y].push_back(x); } for (int i = 0; i < q; ++i){ cin>>x>>k; set<int> illegal; queue<int> sira; bool visited[100010]; memset(visited, 0, sizeof(visited)); for (int i = 0; i < k; ++i){ cin>>y; illegal.insert(y); } int uzaklik[100010]; sira.push(x); uzaklik[x]=0; int maxi=0; while(!sira.empty()){ int node=sira.front(); sira.pop(); for (int i = 0; i < edges[node].size(); ++i){ if(uzaklik[node]+1>edges[node][i]){ sira.push(edges[node][i]); uzaklik[edges[node][i]]=uzaklik[node]+1; if(illegal.find(edges[node][i])==illegal.end())maxi=max(maxi, uzaklik[edges[node][i]]); } } } cout<<maxi<<endl; } }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:36:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = 0; i < edges[node].size(); ++i){
                             ~~^~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...