제출 #104531

#제출 시각아이디문제언어결과실행 시간메모리
104531tc_abd철인 이종 경기 (APIO18_duathlon)C++14
0 / 100
1072 ms7292 KiB
#include <bits/stdc++.h> using namespace std; int n,m,ans,curr=1; int psum[100009]; bool done[100009]; vector < int > v[100009]; void dfs(int node){ psum[node] = curr++; done[node] = 1; for(int i=0;i<v[node].size();i++){ int u = v[node][i]; if(!done[u]) dfs(u); } int x = psum[node] - 2; if(x > 0) ans += x*(x+1)/2; } int main(){ cin>>n>>m; for(int i=0;i<m;i++){ int a,b; cin>>a>>b; a--;b--; v[a].push_back(b); v[b].push_back(a); } for(int i=0;i<n;i++){ if(v[i].size() == 1){ memset(done,0,sizeof(done)); memset(psum,0,sizeof(psum)); curr = 1; dfs(i); } } cout<<ans<<endl; }

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

count_triplets.cpp: In function 'void dfs(int)':
count_triplets.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v[node].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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...