QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463339#63. Meetingsthangthang0 34ms4028kbC++201.1kb2024-07-04 18:24:192024-07-04 18:24:20

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 18:24:20]
  • 评测
  • 测评结果:0
  • 用时:34ms
  • 内存:4028kb
  • [2024-07-04 18:24:19]
  • 提交

answer

#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;
    int sz = 0;
    for (auto u : cur){
        if (u == root) continue;
        bool used = false;
        for (int i = 0; i < sz; ++ 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});
            ++ sz;
        }
    }

    for (int i = 0; i < sz; ++ 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);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 7
Accepted
time: 0ms
memory: 3784kb

input:

3
0 2
0 1

output:

Accepted: 1

result:

ok 1 move(s)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

4
1 2
0 2
0 3

output:

Accepted: 2

result:

ok 2 move(s)

Test #3:

score: -7
Wrong Answer
time: 0ms
memory: 3808kb

input:

4
0 3
2 3
0 1

output:

Wrong Answer [3]

result:

wrong answer 

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #40:

score: 0
Wrong Answer
time: 34ms
memory: 4028kb

input:

2000
58 503
623 1403
1004 1083
249 491
1524 1849
192 562
1261 1877
547 909
267 896
747 1986
381 1329
57 317
779 886
469 1652
628 1456
1732 1790
700 825
494 1799
1450 1733
103 1069
1114 1342
243 1496
930 1361
240 905
398 1737
1008 1765
357 954
1157 1898
1228 1344
1062 1731
160 1977
40 364
343 694
108...

output:

Wrong Answer [3]

result:

wrong answer