Submission #1014061

# Submission time Handle Problem Language Result Execution time Memory
1014061 2024-07-04T10:19:33 Z thangdz2k7 Meetings (JOI19_meetings) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "meetings.h"

using namespace std;

mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
#define rand rd

long long Rand(long long l, long long h) {
    assert(l <= h);
    return l + rd() * 1LL * rd() % (h - l + 1);
}

void cen(vector <int> &cur){
    int n = cur.size(); if (n == 1) return;

    int root = cur[Rand(0, n - 1)];
    vector <vector <int>> sub;
    for (auto u : cur){
        if (u == root) continue;
        bool used = false;
        for (int i = 0; i < sub.size(); ++ i){
            int par = sub[i][0];
            int lca = Query(root, par, u);
            if (lca == root) continue;
            sub[i].push_back(u);
            if (lca == u) swap(sub[i][sub[i].size() - 1], sub[i][0]);
            used = true;
        }
        if (!used) sub.push_back({u});
    }

    for (int i = 0; i < sub.size(); ++ i){
        Bridge(root, sub[i][0]);
        cen(sub[i]);
    }
}

void solve(int N){
    vector <int> cur = {};
    for (int i = 0; i < N; ++ i) cur.push_back(i);
    cen(cur);
}

Compilation message

meetings.cpp: In function 'void cen(std::vector<int>&)':
meetings.cpp:22:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int i = 0; i < sub.size(); ++ i){
      |                         ~~^~~~~~~~~~~~
meetings.cpp:33:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for (int i = 0; i < sub.size(); ++ i){
      |                     ~~^~~~~~~~~~~~
/usr/bin/ld: /tmp/ccxVZnQ0.o: in function `main':
grader.cpp:(.text.startup+0x15b): undefined reference to `Solve(int)'
collect2: error: ld returned 1 exit status