Submission #869782

# Submission time Handle Problem Language Result Execution time Memory
869782 2023-11-05T16:16:02 Z Ariadna ICC (CEOI16_icc) C++14
7 / 100
229 ms 620 KB
#include <bits/stdc++.h>
#include "icc.h"

using namespace std;

vector < int > p;

int root(int a) {
    if (p[a] == a) return a;
    return p[a] = root(p[a]);
}

void join(int a, int b) {
    p[root(a)] = root(b);
}

void run(int N) {
    p = vector < int >(N);
    for (int i = 0; i < N; ++i) {
        p[i] = i;
    }
    for (int t = 1; t < N; ++t) {
        bool founded = false;
        for (int i = 0; i < N && !founded; ++i) {
            for (int j = i + 1; j < N && !founded; ++j) {
                if (root(i) == root(j)) continue;
                int a[1] = {i + 1};
                int b[1] = {j + 1};
                if (query(1, 1, a, b)) {
                    setRoad(i + 1, j + 1);
                    join(i, j);
                    founded = true;
                }
            }
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 40 ms 600 KB Ok! 1015 queries used.
2 Correct 40 ms 604 KB Ok! 1010 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 215 ms 604 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 229 ms 604 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 220 ms 620 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 201 ms 600 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 166 ms 604 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -