Submission #86680

#TimeUsernameProblemLanguageResultExecution timeMemory
86680dimash241Pipes (CEOI15_pipes)C++17
10 / 100
432 ms65536 KiB
# include <stdio.h> # include <bits/stdc++.h> #define Accepted 0 #define pb push_back #define F first #define S second #define For(i,x,y) for (int i = x; i <= y; i ++) #define FOr(i,x,y) for (int i = x; i >= y; i --) #define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0) using namespace std; int n, m; bitset < 30101 > g[30101]; bitset < 30101 > has[30101]; bitset < 30101 > was[30101]; bitset < 30101 > ans[30101]; int tin[30101]; int fup[30101]; int timer; inline void dfs (int v, int par) { tin[v] = fup[v] = ++ timer; for (int i = g[v]._Find_first(); i < g[v].size(); i = g[v]._Find_next(i)) { if (i == par) continue; if (tin[i]) { fup[v] = min(fup[v], tin[i]); } else { dfs (i, v); fup[v] = min(fup[v], fup[i]); if (tin[v] < fup[i]) { if(has[v][i]) continue; ans[min(v, i)][max(v, i)] = 1; } } } } int main () { cin >> n >> m; For (i, 1, m) { int l, r; cin >> l >> r; if (was[l][r]) { has[l][r] = 1; has[r][l] = 1; } was[l][r] = 1; was[r][l] = 1; g[l][r] = 1; g[r][l] = 1; } For (i, 1, n) { if (!tin[i]) { dfs (i, i); } } For (v, 1, n) { for (int i = ans[v]._Find_first(); i < ans[v].size(); i = ans[v]._Find_next(i)) cout << v << ' ' << i << '\n'; } return Accepted; }

Compilation message (stderr)

pipes.cpp: In function 'void dfs(int, int)':
pipes.cpp:26:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = g[v]._Find_first(); i < g[v].size(); i = g[v]._Find_next(i)) {
                                   ~~^~~~~~~~~~~~~
pipes.cpp: In function 'int main()':
pipes.cpp:63:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for (int i = ans[v]._Find_first(); i < ans[v].size(); i = ans[v]._Find_next(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...
#Verdict Execution timeMemoryGrader output
Fetching results...