Submission #690530

#TimeUsernameProblemLanguageResultExecution timeMemory
690530thinh1711Bridges (APIO19_bridges)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define reu(i,a,b) for (int i=a;i<=b;++i) #define pb push_back using namespace std; int n,m; const int mx=100002; int bridge[mx]; vector<pair<int , int> > ke[mx]; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>m; memset(dist,0,sizeof(dist)); reu(i,1,m){ int u,v,d; cin>>u>>v; ke[u].pb({v,i}); ke[v].pb({u,i}); cin>>d; bridge[i]=d; } int q; cin>>q; reu(i,1,q) { int typ; cin>>typ; if (typ==1){ int v,w; cin>>v>>w; bridge[v]=w; } else { bool is[mx]; int cnt=1; memset(is,true,sizeof(is)); int w,s; cin>>s>>w; is[s]=false; queue<int> q; q.push(s); while (!q.empty()){ int h=q.front(); q.pop(); for (auto x:ke[h]) if (is[x.first]==true) if (bridge[x.second]>=w){ is[x.first]=false; q.push(x.first); ++cnt; } } cout<<cnt<<"\n"; } } return 0; }

Compilation message (stderr)

bridges.cpp: In function 'int main()':
bridges.cpp:13:12: error: 'dist' was not declared in this scope
   13 |     memset(dist,0,sizeof(dist));
      |            ^~~~