Submission #34380

#TimeUsernameProblemLanguageResultExecution timeMemory
34380mohammad_kilaniPipes (CEOI15_pipes)C++14
10 / 100
698 ms23368 KiB
#include <bits/stdc++.h> using namespace std; #define mod 1000007 #define oo 2000000000 const int M = 1500010 , N = 30011; bitset< N > vis; vector< int > g[N]; int dfs_low[N], dfs_num[N], num = 0 ; int n , m , u , v; void DFS(int node,int prnt){ vis[node] = true; dfs_low[node] = dfs_num[node] = num++; for(int i=0;i<g[node].size();i++){ if(g[node][i] == prnt) continue; if(vis[g[node][i]]){ dfs_low[node] = min(dfs_low[node],dfs_num[g[node][i]]); } else{ DFS(g[node][i],node); if(dfs_num[node] < dfs_low[g[node][i]]){ printf("%d %d\n",node,g[node][i]); } dfs_low[node] = min(dfs_low[node],dfs_low[g[node][i]]); } } } int main() { //freopen("in.txt","r",stdin); 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); } for(int i=1;i<=n;i++){ if(vis[i] == false) DFS(i,-1); } return 0; }

Compilation message (stderr)

pipes.cpp: In function 'void DFS(int, int)':
pipes.cpp:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<g[node].size();i++){
              ~^~~~~~~~~~~~~~~
pipes.cpp: In function 'int main()':
pipes.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
pipes.cpp:33:8: 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...
#Verdict Execution timeMemoryGrader output
Fetching results...