제출 #55696

#제출 시각아이디문제언어결과실행 시간메모리
55696mohammad_kilani철인 이종 경기 (APIO18_duathlon)C++17
5 / 100
1083 ms10204 KiB
#include <bits/stdc++.h> using namespace std; #define mod 1000000007 #define oo 1000000000 const int N = 100010; int n , m , u , v , needed1, needed2; vector< int > g[N] ; int vis[N] ,vis2[N] , vi , vi2; bool DFS2(int node){ if(vis[node] == vi || vis2[node] == vi2) return false; if(node == needed2) return true; vis2[node] = vi2; for(int i=0;i<g[node].size();i++){ if(DFS2(g[node][i])) return true; } return false; } bool DFS(int node){ if(vis[node] == vi) return false; if(node == needed1){ vi2++; return DFS2(node); } vis[node] = vi; for(int i=0;i<g[node].size();i++){ if(DFS(g[node][i])) return true; } vis[node] = 0; return false; } int main(){ scanf("%d%d",&n,&m); for(int i=0;i<m;i++){ scanf("%d%d",&u,&v); g[u].push_back(v); g[v].push_back(u); } int ans = 0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ for(int k=1;k<=n;k++){ if(i == j || i == k || j == k) continue; needed1 = j; needed2 = k; vi++; if(DFS(i)){ ans++; } } } } cout << ans << endl; return 0; }

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

count_triplets.cpp: In function 'bool DFS2(int)':
count_triplets.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<g[node].size();i++){
                 ~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'bool DFS(int)':
count_triplets.cpp:28:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<g[node].size();i++){
                 ~^~~~~~~~~~~~~~~
count_triplets.cpp: In function 'int main()':
count_triplets.cpp:38:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
count_triplets.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&u,&v);
         ~~~~~^~~~~~~~~~~~~~
#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...