답안 #202077

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
202077 2020-02-13T14:36:00 Z EntityIT 항공 노선도 (JOI18_airline) C++14
37 / 100
686 ms 30904 KB
#include "Alicelib.h"
#include<bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

void Alice(int N, int M, int A[], int B[]) {
  vector<pair<int, int> > edge;

  for (int i = 0; i < M; ++i) edge.emplace_back(A[i], B[i]);
  for (int i = 0; i < 10; ++i) {
    for (int u = 0; u < N; ++u) if ( (u >> i) & 1) edge.emplace_back(u, N + i);
    edge.emplace_back(N + i, N + 11);
    if (i + 1 < 10) edge.emplace_back(N + i, N + i + 1);
  }
  for (int u = 0; u < N; ++u) {
    edge.emplace_back(u, N + 10);
    edge.emplace_back(u, N + 11);
  }

  InitG(N + 12, sz(edge) );
  for (int i = 0; i < sz(edge); ++i) MakeG(i, edge[i].first, edge[i].second);
}

#include "Boblib.h"
#include<bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(), (x).end()
#define sz(x) ( (int)(x).size() )
using LL = long long;

void Bob(int V, int U, int C[], int D[]){
  int N = V - 12;
  vector<vector<int> > gr(V);
  for (int i = 0; i < U; ++i) {
    gr[ C[i] ].emplace_back(D[i]);
    gr[ D[i] ].emplace_back(C[i]);
  }

  vector<int> extra(12);

  vector<int> deg(V);
  for (int i = 0; i < U; ++i) ++deg[ C[i] ], ++deg[ D[i] ];
  extra.back() = (int)(max_element(all(deg) ) - deg.begin() );

  vector<bool> vis(V); vis[extra.back()] = true;
  for (int u : gr[extra.back()]) vis[u] = true;
  extra.rbegin()[1] = (int)(find(all(vis), false) - vis.begin() );

  vis.assign(V, false); vis[extra.back()] = vis[extra.rbegin()[1] ] = true;
  for (int u : gr[ extra.rbegin()[1] ]) vis[u] = true;

  int tmp = (int)(find(all(vis), false) - vis.begin() );
  vector<int> bitNode{ tmp }; vis[tmp] = true;
  for (int u : gr[tmp]) if (!vis[u]) {
    reverse(all(bitNode) );
    for (int cur = u; cur != -1; ) {
      bitNode.emplace_back(cur); vis[cur] = true;
      int nxt = -1;
      for (int v : gr[cur]) if (!vis[v]) nxt = v;
      cur = nxt;
    }
  }
  if (N <= (1 << 9) ) {
    if (deg[ bitNode[0] ] == 2) reverse(all(bitNode) );
  }
  else {
    if (deg[ bitNode[0] ] - 2 != N / 2) reverse(all(bitNode) );
  }
  for (int i = 0; i < sz(bitNode); ++i) extra[i] = bitNode[i];

  vis.assign(V, false);
  for (int u : extra) vis[u] = true;
  vector<int> lable(V, 0);
  for (int i = 0; i < 10; ++i) {
    for (int u : gr[ extra[i] ]) if (!vis[u]) lable[u] |= 1 << i;
  }

  vector<pair<int, int> > edge;
  for (int i = 0; i < U; ++i) if (!vis[ C[i] ] && !vis[ D[i] ]) edge.emplace_back(lable[ C[i] ], lable[ D[i] ]);

  InitMap(N, sz(edge) );
  for (auto _ : edge) MakeMap(_.first, _.second);
}

# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 6896 KB Output is correct
2 Correct 14 ms 6896 KB Output is correct
3 Correct 15 ms 6896 KB Output is correct
4 Correct 13 ms 6896 KB Output is correct
5 Correct 13 ms 6640 KB Output is correct
6 Correct 15 ms 6640 KB Output is correct
7 Correct 14 ms 6768 KB Output is correct
8 Correct 14 ms 6640 KB Output is correct
9 Correct 14 ms 6640 KB Output is correct
10 Correct 15 ms 6896 KB Output is correct
11 Correct 15 ms 6896 KB Output is correct
12 Correct 14 ms 6640 KB Output is correct
13 Correct 15 ms 6640 KB Output is correct
14 Correct 19 ms 6640 KB Output is correct
15 Correct 13 ms 6640 KB Output is correct
16 Correct 16 ms 6640 KB Output is correct
17 Correct 13 ms 6904 KB Output is correct
18 Correct 14 ms 6640 KB Output is correct
19 Correct 14 ms 6896 KB Output is correct
20 Correct 13 ms 6640 KB Output is correct
21 Correct 13 ms 6640 KB Output is correct
22 Correct 15 ms 6640 KB Output is correct
23 Correct 14 ms 6640 KB Output is correct
24 Correct 13 ms 6640 KB Output is correct
25 Correct 14 ms 6640 KB Output is correct
26 Correct 15 ms 6896 KB Output is correct
27 Correct 14 ms 6896 KB Output is correct
28 Correct 15 ms 6640 KB Output is correct
29 Correct 13 ms 6640 KB Output is correct
30 Correct 15 ms 6896 KB Output is correct
31 Correct 13 ms 6896 KB Output is correct
32 Correct 14 ms 6640 KB Output is correct
33 Correct 13 ms 6640 KB Output is correct
34 Correct 14 ms 6648 KB Output is correct
35 Correct 14 ms 6896 KB Output is correct
36 Correct 14 ms 6640 KB Output is correct
37 Correct 13 ms 6640 KB Output is correct
38 Correct 13 ms 6640 KB Output is correct
39 Correct 13 ms 6600 KB Output is correct
40 Correct 14 ms 6640 KB Output is correct
41 Correct 18 ms 6896 KB Output is correct
42 Correct 13 ms 6896 KB Output is correct
43 Correct 15 ms 6640 KB Output is correct
44 Correct 13 ms 6640 KB Output is correct
45 Correct 14 ms 6640 KB Output is correct
46 Correct 15 ms 6640 KB Output is correct
47 Correct 13 ms 6896 KB Output is correct
48 Correct 13 ms 6640 KB Output is correct
49 Correct 13 ms 6640 KB Output is correct
50 Correct 14 ms 6896 KB Output is correct
51 Correct 13 ms 6896 KB Output is correct
52 Correct 14 ms 6896 KB Output is correct
53 Correct 13 ms 6896 KB Output is correct
54 Correct 13 ms 6896 KB Output is correct
55 Correct 13 ms 6904 KB Output is correct
56 Correct 13 ms 6640 KB Output is correct
57 Correct 13 ms 6896 KB Output is correct
58 Correct 14 ms 6640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 6896 KB Output is correct
2 Correct 14 ms 6896 KB Output is correct
3 Correct 15 ms 6896 KB Output is correct
4 Correct 13 ms 6896 KB Output is correct
5 Correct 13 ms 6640 KB Output is correct
6 Correct 15 ms 6640 KB Output is correct
7 Correct 14 ms 6768 KB Output is correct
8 Correct 14 ms 6640 KB Output is correct
9 Correct 14 ms 6640 KB Output is correct
10 Correct 15 ms 6896 KB Output is correct
11 Correct 15 ms 6896 KB Output is correct
12 Correct 14 ms 6640 KB Output is correct
13 Correct 15 ms 6640 KB Output is correct
14 Correct 19 ms 6640 KB Output is correct
15 Correct 13 ms 6640 KB Output is correct
16 Correct 16 ms 6640 KB Output is correct
17 Correct 13 ms 6904 KB Output is correct
18 Correct 14 ms 6640 KB Output is correct
19 Correct 14 ms 6896 KB Output is correct
20 Correct 13 ms 6640 KB Output is correct
21 Correct 13 ms 6640 KB Output is correct
22 Correct 15 ms 6640 KB Output is correct
23 Correct 14 ms 6640 KB Output is correct
24 Correct 13 ms 6640 KB Output is correct
25 Correct 14 ms 6640 KB Output is correct
26 Correct 15 ms 6896 KB Output is correct
27 Correct 14 ms 6896 KB Output is correct
28 Correct 15 ms 6640 KB Output is correct
29 Correct 13 ms 6640 KB Output is correct
30 Correct 15 ms 6896 KB Output is correct
31 Correct 13 ms 6896 KB Output is correct
32 Correct 14 ms 6640 KB Output is correct
33 Correct 13 ms 6640 KB Output is correct
34 Correct 14 ms 6648 KB Output is correct
35 Correct 14 ms 6896 KB Output is correct
36 Correct 14 ms 6640 KB Output is correct
37 Correct 13 ms 6640 KB Output is correct
38 Correct 13 ms 6640 KB Output is correct
39 Correct 13 ms 6600 KB Output is correct
40 Correct 14 ms 6640 KB Output is correct
41 Correct 18 ms 6896 KB Output is correct
42 Correct 13 ms 6896 KB Output is correct
43 Correct 15 ms 6640 KB Output is correct
44 Correct 13 ms 6640 KB Output is correct
45 Correct 14 ms 6640 KB Output is correct
46 Correct 15 ms 6640 KB Output is correct
47 Correct 13 ms 6896 KB Output is correct
48 Correct 13 ms 6640 KB Output is correct
49 Correct 13 ms 6640 KB Output is correct
50 Correct 14 ms 6896 KB Output is correct
51 Correct 13 ms 6896 KB Output is correct
52 Correct 14 ms 6896 KB Output is correct
53 Correct 13 ms 6896 KB Output is correct
54 Correct 13 ms 6896 KB Output is correct
55 Correct 13 ms 6904 KB Output is correct
56 Correct 13 ms 6640 KB Output is correct
57 Correct 13 ms 6896 KB Output is correct
58 Correct 14 ms 6640 KB Output is correct
59 Correct 15 ms 6896 KB Output is correct
60 Correct 16 ms 6896 KB Output is correct
61 Correct 13 ms 6640 KB Output is correct
62 Correct 14 ms 6896 KB Output is correct
63 Correct 14 ms 6904 KB Output is correct
64 Correct 14 ms 6640 KB Output is correct
65 Correct 14 ms 6640 KB Output is correct
66 Correct 15 ms 6640 KB Output is correct
67 Correct 14 ms 6640 KB Output is correct
68 Correct 13 ms 6896 KB Output is correct
69 Correct 14 ms 6640 KB Output is correct
70 Correct 14 ms 6896 KB Output is correct
71 Correct 13 ms 6640 KB Output is correct
72 Correct 15 ms 6896 KB Output is correct
73 Correct 14 ms 6640 KB Output is correct
74 Correct 13 ms 6640 KB Output is correct
75 Correct 13 ms 6640 KB Output is correct
76 Correct 15 ms 6640 KB Output is correct
77 Correct 15 ms 6640 KB Output is correct
78 Correct 15 ms 6640 KB Output is correct
79 Correct 15 ms 6640 KB Output is correct
80 Correct 13 ms 6648 KB Output is correct
81 Correct 14 ms 6744 KB Output is correct
82 Correct 14 ms 6896 KB Output is correct
83 Correct 14 ms 6640 KB Output is correct
84 Correct 14 ms 6824 KB Output is correct
85 Correct 16 ms 6896 KB Output is correct
86 Correct 14 ms 6640 KB Output is correct
87 Correct 14 ms 6648 KB Output is correct
88 Correct 14 ms 6640 KB Output is correct
89 Correct 13 ms 6896 KB Output is correct
90 Correct 15 ms 6640 KB Output is correct
91 Correct 13 ms 6640 KB Output is correct
92 Correct 13 ms 6640 KB Output is correct
93 Correct 13 ms 6640 KB Output is correct
94 Correct 14 ms 6640 KB Output is correct
95 Correct 15 ms 6896 KB Output is correct
96 Correct 15 ms 6896 KB Output is correct
97 Correct 15 ms 6904 KB Output is correct
98 Correct 14 ms 6640 KB Output is correct
99 Correct 15 ms 6896 KB Output is correct
100 Correct 13 ms 6640 KB Output is correct
101 Correct 15 ms 6640 KB Output is correct
102 Correct 13 ms 6640 KB Output is correct
103 Correct 13 ms 6648 KB Output is correct
104 Correct 13 ms 6896 KB Output is correct
105 Correct 14 ms 6896 KB Output is correct
106 Correct 14 ms 6896 KB Output is correct
107 Correct 15 ms 7152 KB Output is correct
108 Correct 13 ms 6640 KB Output is correct
109 Correct 14 ms 6640 KB Output is correct
110 Correct 14 ms 6896 KB Output is correct
111 Correct 14 ms 6640 KB Output is correct
112 Correct 14 ms 6896 KB Output is correct
113 Correct 13 ms 6640 KB Output is correct
114 Correct 13 ms 6640 KB Output is correct
115 Correct 15 ms 6896 KB Output is correct
116 Correct 13 ms 6640 KB Output is correct
117 Correct 13 ms 6896 KB Output is correct
118 Correct 15 ms 6640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 686 ms 30656 KB Output is correct : V - N = 12
2 Correct 532 ms 25756 KB Output is correct : V - N = 12
3 Correct 212 ms 14024 KB Output is correct : V - N = 12
4 Correct 23 ms 7480 KB Output is correct : V - N = 12
5 Correct 133 ms 11224 KB Output is correct : V - N = 12
6 Correct 436 ms 24016 KB Output is correct : V - N = 12
7 Correct 680 ms 30424 KB Output is correct : V - N = 12
8 Correct 599 ms 27768 KB Output is correct : V - N = 12
9 Correct 302 ms 17352 KB Output is correct : V - N = 12
10 Correct 51 ms 8168 KB Output is correct : V - N = 12
11 Correct 73 ms 9184 KB Output is correct : V - N = 12
12 Correct 354 ms 18888 KB Output is correct : V - N = 12
13 Correct 633 ms 28864 KB Output is correct : V - N = 12
14 Correct 629 ms 29880 KB Output is correct : V - N = 12
15 Correct 387 ms 22588 KB Output is correct : V - N = 12
16 Correct 102 ms 9952 KB Output is correct : V - N = 12
17 Correct 32 ms 7664 KB Output is correct : V - N = 12
18 Correct 262 ms 15552 KB Output is correct : V - N = 12
19 Correct 556 ms 26780 KB Output is correct : V - N = 12
20 Correct 671 ms 30904 KB Output is correct : V - N = 12
21 Correct 182 ms 13272 KB Output is correct : V - N = 12
22 Correct 146 ms 12240 KB Output is correct : V - N = 12
23 Correct 65 ms 8928 KB Output is correct : V - N = 12
24 Correct 17 ms 6904 KB Output is correct : V - N = 12
25 Correct 49 ms 8168 KB Output is correct : V - N = 12
26 Correct 133 ms 10960 KB Output is correct : V - N = 12
27 Correct 181 ms 13272 KB Output is correct : V - N = 12
28 Correct 180 ms 12504 KB Output is correct : V - N = 12
29 Correct 91 ms 9696 KB Output is correct : V - N = 12
30 Correct 19 ms 7408 KB Output is correct : V - N = 12
31 Correct 19 ms 7152 KB Output is correct : V - N = 12
32 Correct 19 ms 7408 KB Output is correct : V - N = 12
33 Correct 18 ms 7152 KB Output is correct : V - N = 12
34 Correct 20 ms 7152 KB Output is correct : V - N = 12
35 Correct 22 ms 7152 KB Output is correct : V - N = 12
36 Incorrect 681 ms 30656 KB Wrong Answer [11]
37 Halted 0 ms 0 KB -