Submission #1022004

#TimeUsernameProblemLanguageResultExecution timeMemory
1022004vjudge1Pipes (CEOI15_pipes)C++17
10 / 100
966 ms65536 KiB
#include <bits/stdc++.h>

#define ll long long
using namespace std;
const  int N = 1e5 + 2;
vector < int > adj[N + 2];
int low[N + 2] , num[N + 2] , timer;
void dfs(int u , int p){
    low[u] = num[u] = ++timer;
    for(int v:adj[u]){
        if(v == p) continue;
        if(!num[v]){
            dfs(v , u);
            low[u] = min(low[u] , low[v]);
            if(low[v] == num[v]) cout << u << " " << v <<'\n';
        }
        else low[u] = min(low[u] , num[v]);

    }
}
void solve() {
    int n, m;
    cin >> n >> m;
    for(int i  = 1; i <= m ; i++){
        int u , v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1 , 0);
    
}

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    #define _ "maxseq."
    if (fopen(_ "inp", "r")) {
        freopen(_ "inp", "r", stdin);
        freopen(_ "out", "w", stdout);
    }
    
    solve();
}

Compilation message (stderr)

pipes.cpp: In function 'int main()':
pipes.cpp:39:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |         freopen(_ "inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
pipes.cpp:40:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         freopen(_ "out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...