Submission #152704

# Submission time Handle Problem Language Result Execution time Memory
152704 2019-09-09T08:03:03 Z toloraia Pipes (CEOI15_pipes) C++14
0 / 100
3064 ms 65536 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
//#pragma comment(linker, "/STACK: 20000000005")
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
using namespace std;

const int N = 1e5 + 5, M = 6e6 + 5;

int n, m;
int nn, u[N], v[N];

vector < int > g[N];
int x, y;
int T;
int in[N], up[N];

void dfs (int k, int p){
    in[k] = ++T;
    up[k] = in[k];
    int to, i;
    int num = (int)g[k].size();
    for (i = 0; i < num; i++){
        to = g[k][i];
        if (i && g[k][i - 1] == to)
            continue;
        if (to == p)
            continue;
        if (in[to]){
            up[k] = min (up[k], in[to]);
            continue;
        }
        dfs (to, k);
        if (up[to] > in[k] && (i + 1 == num || g[k][i + 1] != to)){
            nn++;
            u[nn] = k;
            v[nn] = to;
        }
        up[k] = min (up[k], up[to]);
    }
}


main()
{
    //freopen ("in.in", "r", stdin);freopen ("out.out", "w", stdout);
    //ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= m; i++){
        scanf ("%d %d", &x, &y);
        g[x].pb (y);
        //g[y].pb (x);
    }
    /*for (int i = 1; i <= n; i++)
        sort (g[i].begin(), g[i].end());
    for (int i = 1; i <= n; i++)
        if (in[i] == 0)
            dfs (i, 0);*/
    for (int i = 1; i <= nn; i++)
        cout << u[i] << " " << v[i] << endl;
    return 0;
}

Compilation message

pipes.cpp:59:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
pipes.cpp: In function 'int main()':
pipes.cpp:65:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d %d", &x, &y);
         ~~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 2680 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 2808 KB Wrong number of edges
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 155 ms 6672 KB Output is correct
2 Incorrect 152 ms 6520 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 290 ms 8312 KB Output is correct
2 Incorrect 331 ms 10744 KB Wrong number of edges
# Verdict Execution time Memory Grader output
1 Correct 519 ms 13160 KB Output is correct
2 Runtime error 435 ms 25720 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Correct 772 ms 14768 KB Output is correct
2 Runtime error 710 ms 31804 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
# Verdict Execution time Memory Grader output
1 Runtime error 1363 ms 24000 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1758 ms 47476 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2215 ms 65536 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3064 ms 65536 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -