답안 #244516

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
244516 2020-07-04T08:43:46 Z dantoh000 Pipes (CEOI15_pipes) C++14
40 / 100
649 ms 12324 KB
#include <bitset>
#include <utility>
#include <algorithm>
using namespace std;
typedef pair<int,int> ii;
int n,m;
bitset<100000000> M;
bitset<100000000> G;
int num[10005];
int low[10005];
int ct = 1;
int hm[10005];
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 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 55 ms 1920 KB Output is correct
2 Correct 52 ms 1792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 192 ms 2172 KB Output is correct
2 Correct 195 ms 1792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 598 ms 12324 KB Output is correct
2 Correct 649 ms 11308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 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 7 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 6 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 7 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 7 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -