Submission #585550

# Submission time Handle Problem Language Result Execution time Memory
585550 2022-06-29T04:59:48 Z 반딧불(#8385) ICC (CEOI16_icc) C++14
0 / 100
379 ms 492 KB
#include "icc.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

struct unionFind{
    int par[105];
    void init(int _n){
        for(int i=1; i<=_n; i++) par[i] = i;
    }

    int find(int x){
        if(x==par[x]) return x;
        return par[x] = find(par[x]);
    }

    void merge(int x, int y){
        x = find(x), y = find(y);
        par[x] = y;
    }
} dsu;

int n;
bool arr[105][105];
int qa[105], qb[105];

void run(int N){
    n = N;
    dsu.init(n);
    for(int i=1; i<n; i++){
        int X=-1, Y=-1;
        for(int x=1; x<=n; x++){
            for(int y=i+1; y<=n; y++){
                if(dsu.find(x) == dsu.find(y)) continue;
                qa[0]=x, qb[0]=y;
                if(query(1, 1, qa, qb)){
                    X = x, Y = y;
                    goto skip;
                }
            }
        }
        skip:
        setRoad(X, Y);
        arr[X][Y] = arr[Y][X] = 1;
        dsu.merge(X, Y);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 468 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 232 ms 488 KB Wrong road!
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 379 ms 480 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 358 ms 492 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 306 ms 476 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 291 ms 492 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -