Submission #604976

# Submission time Handle Problem Language Result Execution time Memory
604976 2022-07-25T11:42:40 Z Hazem ICC (CEOI16_icc) C++14
7 / 100
351 ms 484 KB
#include <bits/stdc++.h>
#include "icc.h"

using namespace std;

const int N = 2e5+10;

int a[N],par[N];

int find_par(int x){

    if(x==par[x])
        return x;
    
    return par[x] = find_par(par[x]);
}

void run(int n){

    for(int i=1;i<=n;i++)
        par[i] = i;

    int T = n-1;
    while(T--){

        bool q = 0;
        for(int i=1;i<=n;i++){
            if(q)
                break;
            for(int j=i+1;j<=n;j++)
                if(find_par(i)!=find_par(j)){
                    int arr[] = {i};
                    int arr1[] = {j};

                    int v = query(1,1,arr,arr1);
                    if(v){
                        q = 1;
                        setRoad(i,j);
                        par[j] = i;
                        break;
                    }
                }
        }
    }    
}
# Verdict Execution time Memory Grader output
1 Correct 81 ms 468 KB Ok! 1015 queries used.
2 Correct 45 ms 468 KB Ok! 1010 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 275 ms 480 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 351 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 330 ms 484 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 295 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 284 ms 480 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -