This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |