Submission #252148

#TimeUsernameProblemLanguageResultExecution timeMemory
252148SugardorjBridges (APIO19_bridges)C++14
13 / 100
2294 ms524292 KiB
#include <bits/stdc++.h> using namespace std; long long i,j,d[123456],a[123456],b[234567],c[123422],tt; long long x,r,m,n,s,t,k,l,y,z; vector <long long> p[123263],q; void dfs(long long x){ c[x]=1; t++; for (auto u:p[x]){ if (c[u]) continue; dfs(u); } } int main(){ cin >> n>>m; for ( i = 1; i<=m; i ++){ cin >> a[i]>>b[i]>>d[i]; } cin>>tt; while (tt--){ cin >> x>>y>>z; if (x == 1){ d[y] = z; continue; } t = 0; for (i = 1; i<=1234; i ++){ p[i]=q; c[i]=0; } for (i=1; i<=m; i ++){ if (d[i] >= z){ p[a[i]].push_back(b[i]); p[b[i]].push_back(a[i]); } } dfs(y); cout << t<<endl; } return 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...