Submission #239306

#TimeUsernameProblemLanguageResultExecution timeMemory
239306dsjongRailway (BOI17_railway)C++17
0 / 100
52 ms3440 KiB
#include <bits/stdc++.h> using namespace std; int cnt[100005]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, k; cin>>n>>m>>k; assert(m==k); vector<pair<int, int>>edges; for(int i=1;i<n;i++){ int x, y; cin>>x>>y; edges.push_back({x, y}); } memset(cnt, 0, sizeof cnt); for(int i=1;i<=m;i++){ int s; cin>>s; for(int j=1;j<=s;j++){ int x; cin>>x; cnt[x]++; } } vector<int>ans; for(int i=0;i<edges.size();i++){ int x=edges[i].first, y=edges[i].second; if(cnt[x]==m && cnt[y]==m){ ans.push_back(i+1); } } cout<<ans.size()<<"\n"; for(int i:ans){ cout<<i<<" "; } }

Compilation message (stderr)

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