답안 #223893

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223893 2020-04-16T19:59:58 Z MKopchev Pipes (CEOI15_pipes) C++14
20 / 100
1608 ms 65540 KB
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e5+42;

vector< pair<int/*to*/,int/*id*/> > adj[nmax];

int in[nmax],low[nmax],t=0;

int n,m;

void dfs(int node,int par_edge)
{
    if(in[node])return;

    t++;
    in[node]=t;
    low[node]=t;
    //cout<<t<<" -> "<<node<<endl;
    for(auto k:adj[node])
        if(k.second!=par_edge)
        {
            dfs(k.first,k.second);

            //cout<<"finished "<<node<<" "<<k.first<<" "<<low[k.first]<<endl;

            if(in[node]<in[k.first]&&in[node]<low[k.first])
            {
                printf("%i %i\n",node,k.first);
            }
            else low[node]=min(low[k.first],low[node]);
        }
}
int main()
{
    scanf("%i%i",&n,&m);

    int u,v;
    for(int i=1;i<=m;i++)
    {
        scanf("%i%i",&u,&v);
        adj[u].push_back({v,i});
        adj[v].push_back({u,i});
    }

    //cout<<" --- "<<endl;
    for(int i=1;i<=n;i++)
        if(in[i]==0)dfs(i,0);

    return 0;
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:35:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i%i",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
pipes.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i",&u,&v);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2688 KB Output is correct
2 Correct 6 ms 2688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 3328 KB Output is correct
2 Correct 10 ms 3200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 195 ms 23928 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 362 ms 33928 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 677 ms 60620 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1044 ms 65536 KB Memory limit exceeded (if you are sure your verdict is not MLE, please contact us)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1277 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1435 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1417 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1608 ms 65536 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -