Submission #1022008

# Submission time Handle Problem Language Result Execution time Memory
1022008 2024-07-13T08:57:45 Z vjudge1 Pipes (CEOI15_pipes) C++17
10 / 100
983 ms 65536 KB
#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);
    }
    for(int i = 1; i <= n ;i ++){
        if(!num[i]) dfs(i , 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

pipes.cpp: In function 'int main()':
pipes.cpp:41:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen(_ "inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
pipes.cpp:42:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         freopen(_ "out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3160 KB Output is correct
2 Incorrect 2 ms 2648 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3160 KB Output is correct
2 Incorrect 4 ms 3164 KB Wrong number of edges
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 70 ms 11512 KB Output is correct
2 Correct 69 ms 10836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 165 ms 14932 KB Output is correct
2 Runtime error 167 ms 30548 KB Memory limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 253 ms 26196 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 323 ms 32636 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 578 ms 65536 KB Memory limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 770 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 946 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 983 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -