제출 #690498

#제출 시각아이디문제언어결과실행 시간메모리
690498hoangphat120805다리 (APIO19_bridges)C++14
13 / 100
50 ms8036 KiB
#include <bits/stdc++.h> using namespace std; #define reu(i, a, b) for(int i = a, _b = b; i <= _b; ++i) #define red(i, a, b) for(int i = a, _b = b; i >= _b; --i) #define ii pair<int,int> #define fi first #define se second #define pb push_back typedef long long ll; const int N = 5e4 + 5; int n, m, q; int b[N]; vector <ii> adj[N]; int visit[1005]; int bfs(int s, int w){ memset(visit, 0, sizeof visit); int cnt = 1; visit[s] = 1; queue <int> q; q.push(s); while(q.size()){ int u = q.front(); q.pop(); for(ii x: adj[u]){ int v = x.fi, id = x.se; if (b[id] >= w && visit[v] == 0){ cnt++; visit[v] = 1; q.push(v); } } } return cnt; } void sub1() { cin >> q; while(q--){ int type; cin >> type; if (type == 1){ int x, y; cin >> x >> y; b[x] = y; } else { int s, w; cin >> s >> w; cout << bfs(s, w) << '\n'; } } } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("TAITRONG.inp", "r", stdin); // freopen("TAITRONG.out", "w", stdout); cin >> n >> m; reu(i, 1, m){ int u, v, d; cin >> u >> v >> b[i]; adj[u].push_back({v, i}); adj[v].push_back({u, i}); } sub1(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bridges.cpp: In function 'int32_t main()':
bridges.cpp:64:19: warning: unused variable 'd' [-Wunused-variable]
   64 |         int u, v, d;
      |                   ^
#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...