Submission #166900

# Submission time Handle Problem Language Result Execution time Memory
166900 2019-12-04T13:46:29 Z thiago4532 ICC (CEOI16_icc) C++17
7 / 100
66 ms 632 KB
#include "icc.h"
#include <bits/stdc++.h>

using namespace std;

const int maxn = 16;
int pai[maxn], h[maxn];
int n;

int find(int u) {
    if(pai[u] == u) return u;
    return pai[u] = find(pai[u]);
}

void join(int a, int b) {
    a = find(a);
    b = find(b);

    if(h[a] < h[b]) swap(h[a], h[b]);

    pai[b] = a;
    if(h[a]==h[b]) h[a]++;
}

void run(int n_) {
    n = n_;
    for(int i=1;i<=n;i++)
        pai[i] = i;
    
    for(int k=1;k<n;k++) {
        bool certo = false;
        for(int i=1;i<=n;i++) {
            for(int j=i+1;j<=n;j++) {
                if(find(i) == find(j)) continue;
                int a[] = {i};
                int b[] = {j};

                bool x = query(1,1, a, b);
                if(x) {
                    certo = true;
                    setRoad(i, j);
                    break;
                }

            }
            if(certo) break;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 66 ms 504 KB Ok! 1015 queries used.
2 Correct 65 ms 504 KB Ok! 1010 queries used.
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -