Submission #244512

#TimeUsernameProblemLanguageResultExecution timeMemory
244512dwscPipes (CEOI15_pipes)C++14
50 / 100
1308 ms13692 KiB
#include <bits/stdc++.h> using namespace std; int n,m; vector<short> adj[30010]; int low[30010],num[30010],parent[30010]; int counter; void articulationPoint(int u){ // cout << u; low[u] = num[u] = counter++; int parentcount = 0; for (int j = 0; j < adj[u].size(); j++){ int v = adj[u][j]; if (num[v] == -1){ parent[v] = u; articulationPoint(v); if (low[v] > num[u]) cout << u << " " << v << "\n"; low[u] = min(low[u],low[v]); } else if (v != parent[u]){ low[u] = min(low[u],low[v]); } else if (v == parent[u]){ parentcount++; if (parentcount > 1) low[u] = min(low[u],low[v]); } } } int main(){ cin >> n >> m; for (int i = 0; i < m; i++){ int a,b; cin >> a >> b; adj[a].push_back(b); adj[b].push_back(a); } for (int i = 1; i <= n; i++){ num[i] = -1; } for (int i = 1;i <= n; i++) if (num[i] == -1) articulationPoint(i); }

Compilation message (stderr)

pipes.cpp: In function 'void articulationPoint(int)':
pipes.cpp:11:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j = 0; j < adj[u].size(); j++){
                     ~~^~~~~~~~~~~~~~~
#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...