# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
123817 |
2019-07-02T07:24:09 Z |
김세빈(#3028) |
Meetings (JOI19_meetings) |
C++14 |
|
2000 ms |
996 KB |
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
vector <int> T[2020];
int S[2020];
bool chk[2020];
int dfs1(int p, int r)
{
S[p] = 1;
for(int &t: T[p]){
if(t != r){
S[p] += dfs1(t, p);
}
}
return S[p];
}
void dfs2(int p, int r, int x)
{
int v;
for(int t: T[p]){
if(t != r){
v = Query(t, p, x);
if(v == p) continue;
else if(v == t){
dfs2(t, p, x);
return;
}
else{
chk[v] = chk[x] = 1;
for(int &u: T[p]){
if(u == t) u = v;
}
for(int &u: T[t]){
if(u == p) u = v;
}
T[v].push_back(p);
T[v].push_back(t);
if(v != x){
T[v].push_back(x);
T[x].push_back(v);
}
return;
}
}
}
chk[x] = 1;
T[p].push_back(x);
T[x].push_back(p);
}
void Solve(int n)
{
int i, j, v;
v = Query(0, 1, 2);
chk[v] = 1;
for(i=0; i<3; i++){
chk[i] = 1;
if(i != v){
T[i].push_back(v);
T[v].push_back(i);
}
}
for(i=3; i<n; i++){
if(chk[i]) continue;
dfs1(0, 0);
for(j=1; j<=n; j++){
sort(T[j].begin(), T[j].end(), [&](int &a, int &b){
return S[a] > S[b];
});
}
dfs2(0, 0, i);
}
for(i=0; i<n; i++){
for(int &t: T[i]){
if(i < t) Bridge(i, t);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
424 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
424 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
504 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
3 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
504 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
424 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
424 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
504 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
504 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
2 ms |
504 KB |
Output is correct |
26 |
Correct |
3 ms |
504 KB |
Output is correct |
27 |
Correct |
11 ms |
376 KB |
Output is correct |
28 |
Correct |
10 ms |
376 KB |
Output is correct |
29 |
Correct |
11 ms |
440 KB |
Output is correct |
30 |
Correct |
11 ms |
380 KB |
Output is correct |
31 |
Correct |
8 ms |
380 KB |
Output is correct |
32 |
Correct |
10 ms |
376 KB |
Output is correct |
33 |
Correct |
13 ms |
376 KB |
Output is correct |
34 |
Correct |
16 ms |
504 KB |
Output is correct |
35 |
Correct |
16 ms |
504 KB |
Output is correct |
36 |
Correct |
12 ms |
376 KB |
Output is correct |
37 |
Correct |
48 ms |
504 KB |
Output is correct |
38 |
Correct |
70 ms |
376 KB |
Output is correct |
39 |
Correct |
196 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1074 ms |
880 KB |
Output is correct |
2 |
Correct |
1180 ms |
852 KB |
Output is correct |
3 |
Correct |
1123 ms |
820 KB |
Output is correct |
4 |
Correct |
1330 ms |
768 KB |
Output is correct |
5 |
Correct |
900 ms |
844 KB |
Output is correct |
6 |
Correct |
672 ms |
748 KB |
Output is correct |
7 |
Correct |
730 ms |
996 KB |
Output is correct |
8 |
Correct |
754 ms |
920 KB |
Output is correct |
9 |
Correct |
815 ms |
896 KB |
Output is correct |
10 |
Correct |
741 ms |
732 KB |
Output is correct |
11 |
Correct |
887 ms |
892 KB |
Output is correct |
12 |
Execution timed out |
3052 ms |
896 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |