답안 #244571

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244571 2020-07-04T09:58:20 Z dantoh000 Pipes (CEOI15_pipes) C++14
40 / 100
3743 ms 50380 KB
///happy birthday errorgorn
#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:40: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:46: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 5 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 1920 KB Output is correct
2 Correct 60 ms 1808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 208 ms 3064 KB Output is correct
2 Correct 271 ms 2796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 623 ms 13152 KB Output is correct
2 Correct 687 ms 11256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3743 ms 50380 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 896 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 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 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 12 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 11 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -