제출 #337254

#제출 시각아이디문제언어결과실행 시간메모리
337254impri다리 (APIO19_bridges)C++14
13 / 100
3093 ms9264 KiB
#include<bits/stdc++.h> using namespace std; vector<pair<int,int> >graph[50001]; int ds[100001]; int visited[100001]; void dfs(int w,int cur){ visited[cur]=1; for(int i=0;i<graph[cur].size();i++){ if(!visited[graph[cur][i].first] && ds[graph[cur][i].second]>=w){ dfs(w,graph[cur][i].first); } } } int main(){ int n,m; cin >> n >> m; for(int i=1;i<=m;i++){ int u,v,d; cin >> u >> v >> d; graph[u].push_back({v,i}); graph[v].push_back({u,i}); ds[i]=d; } int q; cin >> q; for(int i=1;i<=q;i++){ int t,a,b; cin >> t >> a >> b; if(t==1){ ds[a]=b; } else{ memset(visited,0,sizeof(visited)); dfs(b,a); int res=0; for(int j=1;j<=n;j++){ if(visited[j])res++; } cout << res << '\n'; } } }

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

bridges.cpp: In function 'void dfs(int, int)':
bridges.cpp:8:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | for(int i=0;i<graph[cur].size();i++){
      |             ~^~~~~~~~~~~~~~~~~~
#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...