답안 #244518

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244518 2020-07-04T08:48:34 Z dantoh000 Pipes (CEOI15_pipes) C++14
40 / 100
3545 ms 49304 KB
#include <bitset>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> ii;
int n,m;
bitset<450000000> M;
bitset<450000000> G;
int num[30005];
int low[30005];
int ct = 1;
int hm[30005];
int f(int u, int v){
    if (u > v) swap(u,v);
    //printf("%d %d %d\n",u,v,hm[u]+v);
    return hm[u]+v;
}
void dfs(int u, int p){
    low[u] = num[u] = ct++;
    for (int v = 0; v < n; v++){
        int F = f(u,v);
        if (G[F]){
            if (num[v] == 0){
                dfs(v,u);
                if (low[v] > num[u]){
                    if (M[F] == 0){
                        printf("%d %d\n",u+1,v+1);
                    }
                }
                low[u] = min(low[u],low[v]);
            }
            else if (v != p){
                low[u] = min(low[u],num[v]);
            }
        }
    }
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i = 1; i < n; i++){
        hm[i] = hm[i-1]+(n-i-1);
    }
    for (int i = 0; i < m; i++){
        int u,v;
        scanf("%d%d",&u,&v);
        u--; v--;
        int F = f(u,v);
        if (G[F]){
            M[F] = 1;
        }
        else{
            G[F] = 1;
        }
    }
    /*for (int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            printf("%d %d %d\n",i,j,f(i,j));
        }
    }*/
    for (int i = 0; i < n; i++){
        if (num[i] == 0){
            dfs(i,-1);
        }
    }
}

Compilation message

pipes.cpp: In function 'int main()':
pipes.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
pipes.cpp:45:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&u,&v);
         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 2040 KB Output is correct
2 Correct 52 ms 1792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 195 ms 2172 KB Output is correct
2 Correct 192 ms 1784 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 596 ms 12332 KB Output is correct
2 Correct 654 ms 11340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3545 ms 49304 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 10 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -