Submission #249453

# Submission time Handle Problem Language Result Execution time Memory
249453 2020-07-15T04:55:43 Z dantoh000 Meetings (JOI19_meetings) C++14
29 / 100
2000 ms 904 KB
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> v){
    /*printf("solving ");
    for (auto x : v) printf("%d ",x);
    printf("\n");*/
    if (v.size() == 1) return;
    if (v.size() == 2){
        if (v[0] > v[1]) swap(v[0],v[1]);
        Bridge(v[0],v[1]);
        return;
    }
    random_shuffle(v.begin(),v.end());
    int p = v[0], q = v[1];
    //printf("cur %d, root %d\n",cur,root);
    for (auto x : v){
        if (x == p || x == q) continue;
        int Q = Query(p,q,x);
        if (Q != p) q = Q;
    }
    //printf("cur %d, root %d\n",cur,root);
    if (p > q) swap(p,q);
    Bridge(p,q);
    vector<int> L, R;
    for (auto x : v){
        if (x == q || x == p) continue;
        int Q = Query(p,q,x);
        assert(Q == p || Q == q);
        if (Q == p) R.push_back(x);
        else L.push_back(x);
    }
    L.push_back(q);
    R.push_back(p);
    solve(L);
    solve(R);
}
void Solve(int N) {
    vector<int> cur;
    for (int i = 0; i < N; i++) cur.push_back(i);
    solve(cur);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 512 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 71 ms 580 KB Output is correct
28 Correct 39 ms 512 KB Output is correct
29 Correct 63 ms 512 KB Output is correct
30 Correct 39 ms 632 KB Output is correct
31 Correct 47 ms 512 KB Output is correct
32 Correct 125 ms 632 KB Output is correct
33 Correct 99 ms 632 KB Output is correct
34 Correct 121 ms 648 KB Output is correct
35 Correct 122 ms 760 KB Output is correct
36 Correct 42 ms 504 KB Output is correct
37 Correct 16 ms 384 KB Output is correct
38 Correct 16 ms 384 KB Output is correct
39 Correct 13 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2635 ms 904 KB Time limit exceeded
2 Halted 0 ms 0 KB -