Submission #781118

# Submission time Handle Problem Language Result Execution time Memory
781118 2023-07-12T18:11:41 Z PoonYaPat Meetings (JOI19_meetings) C++14
100 / 100
696 ms 804 KB
#include "meetings.h"
#include <time.h>
#include <bits/stdc++.h>
using namespace std;

int rt;
vector<int> temp[2005];

bool comp(int a, int b) {
  if (Query(rt,a,b)==a) return true;
  else return false;
}

void find(int root) {
  if (temp[root].size()==0) return;
  vector<int> v,path;
  swap(v,temp[root]);
  int sz=v.size(), ed=v[rand()%sz];

  for (auto s : v) {
    if (s==ed) continue;
    int h=Query(root,ed,s);
    if (h==s) path.push_back(s);
    else temp[h].push_back(s);
  }

  rt=root;
  sort(path.begin(),path.end(),comp); //root path ed
  path.push_back(ed);

  Bridge(min(root,path[0]),max(root,path[0]));
  for (int i=1; i<path.size(); ++i) Bridge(min(path[i],path[i-1]),max(path[i],path[i-1]));

  find(root);
  for (auto s : path) find(s);
}

void Solve(int N) {
  srand(time(0));
  for (int i=1; i<N; ++i) temp[0].push_back(i);
  find(0);
}

Compilation message

meetings.cpp: In function 'void find(int)':
meetings.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for (int i=1; i<path.size(); ++i) Bridge(min(path[i],path[i-1]),max(path[i],path[i-1]));
      |                 ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 0 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 0 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 0 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 0 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 0 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 0 ms 336 KB Output is correct
19 Correct 0 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 0 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Correct 0 ms 336 KB Output is correct
5 Correct 0 ms 336 KB Output is correct
6 Correct 0 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 0 ms 336 KB Output is correct
9 Correct 0 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 336 KB Output is correct
12 Correct 0 ms 336 KB Output is correct
13 Correct 0 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 0 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 0 ms 336 KB Output is correct
19 Correct 0 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 0 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 336 KB Output is correct
26 Correct 1 ms 336 KB Output is correct
27 Correct 4 ms 336 KB Output is correct
28 Correct 3 ms 336 KB Output is correct
29 Correct 4 ms 336 KB Output is correct
30 Correct 3 ms 336 KB Output is correct
31 Correct 3 ms 336 KB Output is correct
32 Correct 4 ms 436 KB Output is correct
33 Correct 7 ms 336 KB Output is correct
34 Correct 9 ms 436 KB Output is correct
35 Correct 8 ms 336 KB Output is correct
36 Correct 3 ms 336 KB Output is correct
37 Correct 9 ms 336 KB Output is correct
38 Correct 9 ms 464 KB Output is correct
39 Correct 7 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 203 ms 648 KB Output is correct
2 Correct 219 ms 576 KB Output is correct
3 Correct 263 ms 580 KB Output is correct
4 Correct 246 ms 648 KB Output is correct
5 Correct 183 ms 568 KB Output is correct
6 Correct 175 ms 584 KB Output is correct
7 Correct 382 ms 768 KB Output is correct
8 Correct 452 ms 772 KB Output is correct
9 Correct 445 ms 600 KB Output is correct
10 Correct 426 ms 596 KB Output is correct
11 Correct 482 ms 592 KB Output is correct
12 Correct 214 ms 684 KB Output is correct
13 Correct 121 ms 592 KB Output is correct
14 Correct 254 ms 656 KB Output is correct
15 Correct 280 ms 592 KB Output is correct
16 Correct 283 ms 660 KB Output is correct
17 Correct 440 ms 668 KB Output is correct
18 Correct 209 ms 584 KB Output is correct
19 Correct 253 ms 644 KB Output is correct
20 Correct 263 ms 584 KB Output is correct
21 Correct 260 ms 592 KB Output is correct
22 Correct 234 ms 588 KB Output is correct
23 Correct 232 ms 712 KB Output is correct
24 Correct 228 ms 592 KB Output is correct
25 Correct 241 ms 668 KB Output is correct
26 Correct 264 ms 720 KB Output is correct
27 Correct 237 ms 596 KB Output is correct
28 Correct 504 ms 588 KB Output is correct
29 Correct 401 ms 592 KB Output is correct
30 Correct 423 ms 728 KB Output is correct
31 Correct 444 ms 652 KB Output is correct
32 Correct 696 ms 656 KB Output is correct
33 Correct 480 ms 804 KB Output is correct
34 Correct 3 ms 336 KB Output is correct
35 Correct 3 ms 336 KB Output is correct
36 Correct 3 ms 336 KB Output is correct
37 Correct 3 ms 336 KB Output is correct
38 Correct 3 ms 336 KB Output is correct
39 Correct 4 ms 336 KB Output is correct
40 Correct 7 ms 416 KB Output is correct
41 Correct 9 ms 336 KB Output is correct
42 Correct 8 ms 440 KB Output is correct
43 Correct 3 ms 336 KB Output is correct
44 Correct 7 ms 336 KB Output is correct
45 Correct 9 ms 336 KB Output is correct
46 Correct 4 ms 336 KB Output is correct
47 Correct 0 ms 336 KB Output is correct
48 Correct 0 ms 336 KB Output is correct
49 Correct 0 ms 336 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 0 ms 336 KB Output is correct
52 Correct 1 ms 284 KB Output is correct
53 Correct 0 ms 336 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 0 ms 336 KB Output is correct
60 Correct 0 ms 336 KB Output is correct
61 Correct 0 ms 336 KB Output is correct
62 Correct 0 ms 336 KB Output is correct
63 Correct 0 ms 336 KB Output is correct
64 Correct 0 ms 336 KB Output is correct
65 Correct 0 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 0 ms 336 KB Output is correct
68 Correct 0 ms 336 KB Output is correct
69 Correct 0 ms 336 KB Output is correct
70 Correct 0 ms 336 KB Output is correct
71 Correct 0 ms 336 KB Output is correct
72 Correct 0 ms 336 KB Output is correct