제출 #893444

#제출 시각아이디문제언어결과실행 시간메모리
893444Warinchai다리 (APIO19_bridges)C++14
13 / 100
3060 ms11304 KiB
#include<bits/stdc++.h> using namespace std; vector<pair<int,int> >v[100005]; int w[100005]; int vis[100005]; int dfs(int x,int wc){ vis[x]=1; int sz=1; for(auto e:v[x]){ if(w[e.second]>=wc&&vis[e.first]==0){ sz+=dfs(e.first,wc); } } return sz; } int main(){ int n,m; cin>>n>>m; for(int i=1;i<=m;i++){ int a,b,c; cin>>a>>b>>c; v[a].push_back({b,i}); v[b].push_back({a,i}); w[i]=c; } int q; cin>>q; while(q--){ int t; cin>>t; if(t==1){ int x,r; cin>>x>>r; w[x]=r; }else{ int s,w; cin>>s>>w; cout<<dfs(s,w)<<"\n"; for(int i=1;i<=n;i++)vis[i]=0; } } }
#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...