제출 #568919

#제출 시각아이디문제언어결과실행 시간메모리
568919HappyPacMan다리 (APIO19_bridges)C++14
0 / 100
3078 ms9672 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 5e4 + 2; vector<pair<int,int> > adj[maxn]; vector<tuple<int,int,int> > edge; bool vis[maxn]; int dfs(int u,int c){ if(vis[u]){ return 0; } vis[u] = true; int res = 1; for(auto [v,w] : adj[u]){ if(w >= c){ res += dfs(v,c); } } return res; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m; cin >> n >> m; for(int i=1;i<=m;i++){ int u,v,w; cin >> u >> v >> w; adj[u].emplace_back(v,w); adj[v].emplace_back(u,w); edge.emplace_back(u,v,w); } int q; cin >> q; while(q--){ int t,x,y; cin >> t >> x >> y; if(t == 1){ int u = get<0>(edge[x-1]); int v = get<1>(edge[x-1]); int w = get<2>(edge[x-1]); int ux = lower_bound(adj[u].begin(),adj[u].end(),make_pair(v,w))-adj[u].begin(); int vx = lower_bound(adj[v].begin(),adj[v].end(),make_pair(u,w))-adj[v].begin(); edge[x-1] = make_tuple(u,v,y); adj[u][ux].second = y; adj[v][vx].second = y; }else{ memset(vis,false,sizeof(vis)); cout << dfs(x,y) << '\n'; } } }

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

bridges.cpp: In function 'int dfs(int, int)':
bridges.cpp:14:11: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   14 |  for(auto [v,w] : adj[u]){
      |           ^
#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...