Submission #673736

#TimeUsernameProblemLanguageResultExecution timeMemory
673736meowwTraffic (CEOI11_tra)C++14
32 / 100
56 ms1236 KiB
#include "bits/stdc++.h" using namespace std; const int N=7000; int n,m,a,b,cnt; bool vis[N]; pair<int,int> jun[N]; vector<int> v[N]; void dfs(int i) { vis[i]=true; if (jun[i].first==a) cnt++; for (int j:v[i]) { if (!vis[j]) dfs(j); } } signed main() { cin>>n>>m>>a>>b; for (int i=1;i<=n;i++) { cin>>jun[i].first>>jun[i].second; } for (int i=0;i<m;i++) { int c,d,e; cin>>c>>d>>e; v[c].push_back(d); if (e==2) v[d].push_back(c); } vector<pair<int,int> > wst; for (int i=1;i<=n;i++) { if (jun[i].first==0) wst.push_back({jun[i].second,i}); } sort(wst.rbegin(),wst.rend()); vector<int> ans; for (int i=0;i<wst.size();i++) { cnt=0; for (int j=1;j<=n;j++) vis[j]=false; dfs(wst[i].second); ans.push_back(cnt); } for (int i:ans) cout<<i<<endl; }

Compilation message (stderr)

tra.cpp: In function 'int main()':
tra.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (int i=0;i<wst.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...
#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...