#include "Alicelib.h"
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
//InitG(n, m)
//MakeG(id, u, v)
void Alice(int N, int M, int A[], int B[]) {
vector<pair<int, int>> edges;
for (int i = 0; i < M; i++) {
edges.pb({A[i], B[i]});
}
for (int i = 1; i <= N; i++) {
for (int j = 0; j < 10; j++) {
if ((i >> j) & 1) {
edges.pb({i - 1, N + j});
}
}
}
for (int j = 0; j < 9; j++) {
edges.pb({N + j, N + j + 1});
}
for (int i = 0; i < 10; i++) {
edges.pb({N + i, N + 10});
}
for (int i = 0; i < N + 10; i++) {
edges.pb({i, N + 11});
}
InitG(N + 12, SZ(edges));
for (int i = 0; i < SZ(edges); i++) {
MakeG(i, edges[i].F, edges[i].S);
}
}
#include "Boblib.h"
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
void Bob(int V, int U, int C[], int D[]) {
int n = V - 12;
pair<int, int> mx;
vector<int> cnt(V);
vector<vector<int>> g(V);
for (int i = 0; i < U; i++) {
cnt[C[i]]++;
cnt[D[i]]++;
g[C[i]].pb(D[i]);
g[D[i]].pb(C[i]);
}
for (int i = 0; i < V; i++) {
mx = max(mx, make_pair(cnt[i], i));
}
if (mx.F != n + 10) {
exit(0);
}
//assert(mx.F == n + 10);
vector<bool> used(V);
for (auto it : g[mx.S]) {
used[it] = true;
}
int id = -1;
for (int i = 0; i < V; i++) {
if (!used[i] && i != mx.S) {
id = i;
}
}
if (id == -1) {
exit(0);
}
fill(all(used), true);
used[id] = false;
used[mx.S] = false;
for (auto it : g[id]) {
used[it] = false;
}
int fst = -1;
for (int i = 0; i < V; i++) {
if (!used[i] && i != id && i != mx.S) {
int cc = 0;
for (auto it : g[i]) {
if (!used[it] && it != id && it != mx.S) {
cc++;
}
}
if (cc == 1) {
fst = i;
break;
}
}
}
int prv = 0, cur = fst;
vector<int> path = {cur};
for (int i = 0; i < 9; i++) {
for (auto it : g[cur]) {
if (!used[it] && it != id && it != mx.S && it != prv) {
path.pb(it);
prv = cur;
cur = it;
break;
}
}
}
if (cnt[path[0]] < cnt[path.back()]) {
reverse(all(path));
}
if (SZ(path) < 10) {
exit(0);
}
vector<vector<bool>> ok(10, vector<bool>(V));
for (int i = 0; i < 10; i++) {
for (auto it : g[path[i]]) {
ok[i][it] = true;
}
}
vector<pair<int, int>> rez;
vector<int> go(V);
for (int i = 0; i < V; i++) {
if (used[i]) {
int vl = 0;
for (int j = 0; j < 10; j++) {
if (ok[j][i]) {
vl += 1 << j;
}
}
vl--;
go[i] = vl;
}
}
for (int i = 0; i < U; i++) {
if (used[C[i]] && used[D[i]]) {
rez.pb({go[C[i]], go[D[i]]});
}
}
InitMap(n, SZ(rez));
for (auto it : rez) {
MakeMap(it.F, it.S);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
6912 KB |
Output is correct |
2 |
Correct |
13 ms |
6912 KB |
Output is correct |
3 |
Correct |
13 ms |
6912 KB |
Output is correct |
4 |
Correct |
13 ms |
6912 KB |
Output is correct |
5 |
Correct |
13 ms |
6912 KB |
Output is correct |
6 |
Correct |
13 ms |
6912 KB |
Output is correct |
7 |
Correct |
13 ms |
6912 KB |
Output is correct |
8 |
Correct |
13 ms |
6912 KB |
Output is correct |
9 |
Correct |
14 ms |
6912 KB |
Output is correct |
10 |
Correct |
13 ms |
6912 KB |
Output is correct |
11 |
Correct |
13 ms |
6912 KB |
Output is correct |
12 |
Correct |
13 ms |
7008 KB |
Output is correct |
13 |
Correct |
13 ms |
6912 KB |
Output is correct |
14 |
Correct |
13 ms |
6912 KB |
Output is correct |
15 |
Correct |
13 ms |
6912 KB |
Output is correct |
16 |
Correct |
13 ms |
7168 KB |
Output is correct |
17 |
Correct |
13 ms |
6912 KB |
Output is correct |
18 |
Correct |
13 ms |
6912 KB |
Output is correct |
19 |
Correct |
13 ms |
6912 KB |
Output is correct |
20 |
Correct |
13 ms |
6912 KB |
Output is correct |
21 |
Correct |
13 ms |
6912 KB |
Output is correct |
22 |
Correct |
13 ms |
6912 KB |
Output is correct |
23 |
Correct |
13 ms |
6912 KB |
Output is correct |
24 |
Correct |
13 ms |
6912 KB |
Output is correct |
25 |
Correct |
13 ms |
6912 KB |
Output is correct |
26 |
Correct |
13 ms |
6912 KB |
Output is correct |
27 |
Correct |
13 ms |
6912 KB |
Output is correct |
28 |
Correct |
13 ms |
6912 KB |
Output is correct |
29 |
Correct |
13 ms |
6912 KB |
Output is correct |
30 |
Correct |
13 ms |
6776 KB |
Output is correct |
31 |
Correct |
13 ms |
6656 KB |
Output is correct |
32 |
Correct |
13 ms |
6912 KB |
Output is correct |
33 |
Correct |
13 ms |
6656 KB |
Output is correct |
34 |
Correct |
13 ms |
6912 KB |
Output is correct |
35 |
Correct |
13 ms |
6656 KB |
Output is correct |
36 |
Correct |
13 ms |
6912 KB |
Output is correct |
37 |
Correct |
13 ms |
6912 KB |
Output is correct |
38 |
Correct |
13 ms |
6912 KB |
Output is correct |
39 |
Correct |
13 ms |
6912 KB |
Output is correct |
40 |
Correct |
15 ms |
6912 KB |
Output is correct |
41 |
Correct |
13 ms |
6912 KB |
Output is correct |
42 |
Correct |
13 ms |
6912 KB |
Output is correct |
43 |
Correct |
13 ms |
6912 KB |
Output is correct |
44 |
Correct |
13 ms |
6656 KB |
Output is correct |
45 |
Correct |
15 ms |
6656 KB |
Output is correct |
46 |
Correct |
13 ms |
6912 KB |
Output is correct |
47 |
Correct |
15 ms |
6912 KB |
Output is correct |
48 |
Correct |
13 ms |
6912 KB |
Output is correct |
49 |
Correct |
13 ms |
6912 KB |
Output is correct |
50 |
Correct |
13 ms |
6656 KB |
Output is correct |
51 |
Correct |
13 ms |
6656 KB |
Output is correct |
52 |
Incorrect |
13 ms |
6912 KB |
Unexpected end of file - token expected |
53 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
6912 KB |
Output is correct |
2 |
Correct |
13 ms |
6912 KB |
Output is correct |
3 |
Correct |
13 ms |
6912 KB |
Output is correct |
4 |
Correct |
13 ms |
6912 KB |
Output is correct |
5 |
Correct |
13 ms |
6912 KB |
Output is correct |
6 |
Correct |
13 ms |
6912 KB |
Output is correct |
7 |
Correct |
13 ms |
6912 KB |
Output is correct |
8 |
Correct |
13 ms |
6912 KB |
Output is correct |
9 |
Correct |
14 ms |
6912 KB |
Output is correct |
10 |
Correct |
13 ms |
6912 KB |
Output is correct |
11 |
Correct |
13 ms |
6912 KB |
Output is correct |
12 |
Correct |
13 ms |
7008 KB |
Output is correct |
13 |
Correct |
13 ms |
6912 KB |
Output is correct |
14 |
Correct |
13 ms |
6912 KB |
Output is correct |
15 |
Correct |
13 ms |
6912 KB |
Output is correct |
16 |
Correct |
13 ms |
7168 KB |
Output is correct |
17 |
Correct |
13 ms |
6912 KB |
Output is correct |
18 |
Correct |
13 ms |
6912 KB |
Output is correct |
19 |
Correct |
13 ms |
6912 KB |
Output is correct |
20 |
Correct |
13 ms |
6912 KB |
Output is correct |
21 |
Correct |
13 ms |
6912 KB |
Output is correct |
22 |
Correct |
13 ms |
6912 KB |
Output is correct |
23 |
Correct |
13 ms |
6912 KB |
Output is correct |
24 |
Correct |
13 ms |
6912 KB |
Output is correct |
25 |
Correct |
13 ms |
6912 KB |
Output is correct |
26 |
Correct |
13 ms |
6912 KB |
Output is correct |
27 |
Correct |
13 ms |
6912 KB |
Output is correct |
28 |
Correct |
13 ms |
6912 KB |
Output is correct |
29 |
Correct |
13 ms |
6912 KB |
Output is correct |
30 |
Correct |
13 ms |
6776 KB |
Output is correct |
31 |
Correct |
13 ms |
6656 KB |
Output is correct |
32 |
Correct |
13 ms |
6912 KB |
Output is correct |
33 |
Correct |
13 ms |
6656 KB |
Output is correct |
34 |
Correct |
13 ms |
6912 KB |
Output is correct |
35 |
Correct |
13 ms |
6656 KB |
Output is correct |
36 |
Correct |
13 ms |
6912 KB |
Output is correct |
37 |
Correct |
13 ms |
6912 KB |
Output is correct |
38 |
Correct |
13 ms |
6912 KB |
Output is correct |
39 |
Correct |
13 ms |
6912 KB |
Output is correct |
40 |
Correct |
15 ms |
6912 KB |
Output is correct |
41 |
Correct |
13 ms |
6912 KB |
Output is correct |
42 |
Correct |
13 ms |
6912 KB |
Output is correct |
43 |
Correct |
13 ms |
6912 KB |
Output is correct |
44 |
Correct |
13 ms |
6656 KB |
Output is correct |
45 |
Correct |
15 ms |
6656 KB |
Output is correct |
46 |
Correct |
13 ms |
6912 KB |
Output is correct |
47 |
Correct |
15 ms |
6912 KB |
Output is correct |
48 |
Correct |
13 ms |
6912 KB |
Output is correct |
49 |
Correct |
13 ms |
6912 KB |
Output is correct |
50 |
Correct |
13 ms |
6656 KB |
Output is correct |
51 |
Correct |
13 ms |
6656 KB |
Output is correct |
52 |
Incorrect |
13 ms |
6912 KB |
Unexpected end of file - token expected |
53 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
661 ms |
30920 KB |
Output is correct : V - N = 12 |
2 |
Correct |
516 ms |
25928 KB |
Output is correct : V - N = 12 |
3 |
Correct |
208 ms |
14164 KB |
Output is correct : V - N = 12 |
4 |
Correct |
20 ms |
7424 KB |
Output is correct : V - N = 12 |
5 |
Correct |
138 ms |
11392 KB |
Output is correct : V - N = 12 |
6 |
Correct |
438 ms |
24036 KB |
Output is correct : V - N = 12 |
7 |
Correct |
669 ms |
30408 KB |
Output is correct : V - N = 12 |
8 |
Correct |
571 ms |
28128 KB |
Output is correct : V - N = 12 |
9 |
Incorrect |
278 ms |
17360 KB |
Unexpected end of file - token expected |
10 |
Halted |
0 ms |
0 KB |
- |