#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()
void Alice(int N, int M, int A[], int B[]) {
InitG(2 * N + 2, M + (N + 2) * (N + 1) / 2 + N * (N + 1) / 2);
int ptr = 0;
for (int i = 0; i < M; i++) {
MakeG(ptr++, A[i], B[i]);
}
for (int i = N + 1; i <= 2 * N + 2; i++) {
for (int j = i + 1; j <= 2 * N + 2; j++) {
MakeG(ptr++, i - 1, j - 1);
}
}
for (int i = 0; i < N; i++) {
for (int j = N; j <= N + i; j++) {
MakeG(ptr++, i, j);
}
}
}
#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 dfs(int v, vector<bool> &used, vector<int> &comp, vector<vector<int>> &g) {
comp.pb(v);
used[v] = true;
for (auto u : g[v]) {
if (!used[u]) {
dfs(u, used, comp, g);
}
}
}
vector<int> get_clique(vector<int> &have, vector<vector<bool>> &ok) {
vector<int> rez;
for (int mask = 1; mask < (1 << (SZ(have))); mask++) {
bool can = true;
for (int i = 0; i < SZ(have); i++) {
if ((mask >> i) & 1) {
int v = have[i];
for (int j = i + 1; j < SZ(have); j++) {
if ((mask >> j) & 1) {
int u = have[j];
if (!ok[u][v]) {
can = false;
}
}
}
}
}
if (can && __builtin_popcount(mask) > SZ(rez)) {
rez = {};
for (int i = 0; i < SZ(have); i++) {
if ((mask >> i) & 1) {
rez.pb(have[i]);
}
}
}
}
return rez;
}
const int N = 80;
bitset<N> a[N];
int n, need;
vector<int> ans;
mt19937 rnd(228);
void rec(bitset<N> can_take, bitset<N> take) {
if (SZ(ans) == need) {
return;
}
if (!can_take.count()) {
if (take.count() > SZ(ans)) {
ans = {};
for (int i = 0; i < n; i++) {
if (take[i]) {
ans.pb(i);
}
}
}
return;
}
if (can_take.count() + take.count() <= SZ(ans)) {
return;
}
pair<int, int> v = {-1, -1};
for (int i = 0; i < n; i++) {
if (can_take[i]) {
int x = (a[i] & can_take).count();
if (x < 2) {
take[i] = 1;
can_take[i] = 0;
can_take ^= (can_take & a[i]);
rec(can_take, take);
return;
}
v = max(v, make_pair(x, i));
}
}
can_take[v.S] = 0;
take[v.S] = 1;
rec(can_take ^ (can_take & a[v.S]), take);
take[v.S] = 0;
rec(can_take, take);
take[v.S] = 0;
can_take[v.S] = 1;
}
void Bob(int V, int U, int C[], int D[]) {
vector<bool> used(V);
vector<vector<int>> g(V);
vector<vector<bool>> ok(V, vector<bool>(V));
for (int i = 0; i < U; i++) {
g[C[i]].pb(D[i]);
g[D[i]].pb(C[i]);
ok[C[i]][D[i]] = ok[D[i]][C[i]] = true;
}
n = V;
need = V / 2 + 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i != j) {
if (ok[i][j]) {
a[i][j] = 0;
}
else {
a[i][j] = 1;
}
}
}
}
bitset<N> can_take, take;
for (int i = 0; i < n; i++) {
can_take[i] = 1;
}
rec(can_take, take);
vector<int> cl = ans;
InitMap(V - SZ(cl), U - SZ(cl) * (SZ(cl) - 1) / 2 - (V - SZ(cl)) * (V - SZ(cl) + 1) / 2);
vector<bool> in_clique(V);
for (auto it : cl) {
in_clique[it] = true;
}
vector<int> id(V + 1);
for (int i = 0; i < V; i++) {
if (!in_clique[i]) {
int cnt = 0;
for (auto u : g[i]) {
if (in_clique[u]) {
cnt++;
}
}
id[i] = cnt;
}
}
for (int v = 0; v < V; v++) {
for (int u : g[v]) {
if (id[v] && id[u] && id[v] < id[u]) {
MakeMap(id[v] - 1, id[u] - 1);
}
}
}
}
Compilation message
Bob.cpp: In function 'void rec(std::bitset<80>, std::bitset<80>)':
Bob.cpp:63:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (take.count() > SZ(ans)) {
^
Bob.cpp:73:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (can_take.count() + take.count() <= SZ(ans)) {
^
# |
결과 |
실행 시간 |
메모리 |
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 |
13 ms |
6912 KB |
Output is correct |
10 |
Correct |
13 ms |
6656 KB |
Output is correct |
11 |
Correct |
13 ms |
6912 KB |
Output is correct |
12 |
Correct |
14 ms |
6912 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 |
6912 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 |
14 ms |
6912 KB |
Output is correct |
25 |
Correct |
17 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 |
6912 KB |
Output is correct |
31 |
Correct |
13 ms |
6912 KB |
Output is correct |
32 |
Correct |
13 ms |
6912 KB |
Output is correct |
33 |
Correct |
13 ms |
6912 KB |
Output is correct |
34 |
Correct |
13 ms |
6656 KB |
Output is correct |
35 |
Correct |
13 ms |
6912 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 |
6720 KB |
Output is correct |
39 |
Correct |
13 ms |
6912 KB |
Output is correct |
40 |
Correct |
13 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 |
14 ms |
6912 KB |
Output is correct |
46 |
Correct |
13 ms |
6912 KB |
Output is correct |
47 |
Correct |
13 ms |
6912 KB |
Output is correct |
48 |
Correct |
14 ms |
6912 KB |
Output is correct |
49 |
Correct |
13 ms |
6912 KB |
Output is correct |
50 |
Correct |
13 ms |
6912 KB |
Output is correct |
51 |
Correct |
13 ms |
6912 KB |
Output is correct |
52 |
Correct |
13 ms |
6912 KB |
Output is correct |
53 |
Correct |
13 ms |
6912 KB |
Output is correct |
54 |
Correct |
13 ms |
6912 KB |
Output is correct |
55 |
Correct |
14 ms |
6912 KB |
Output is correct |
56 |
Correct |
13 ms |
6912 KB |
Output is correct |
57 |
Correct |
16 ms |
6912 KB |
Output is correct |
58 |
Correct |
13 ms |
6912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
13 ms |
6912 KB |
Output is correct |
10 |
Correct |
13 ms |
6656 KB |
Output is correct |
11 |
Correct |
13 ms |
6912 KB |
Output is correct |
12 |
Correct |
14 ms |
6912 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 |
6912 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 |
14 ms |
6912 KB |
Output is correct |
25 |
Correct |
17 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 |
6912 KB |
Output is correct |
31 |
Correct |
13 ms |
6912 KB |
Output is correct |
32 |
Correct |
13 ms |
6912 KB |
Output is correct |
33 |
Correct |
13 ms |
6912 KB |
Output is correct |
34 |
Correct |
13 ms |
6656 KB |
Output is correct |
35 |
Correct |
13 ms |
6912 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 |
6720 KB |
Output is correct |
39 |
Correct |
13 ms |
6912 KB |
Output is correct |
40 |
Correct |
13 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 |
14 ms |
6912 KB |
Output is correct |
46 |
Correct |
13 ms |
6912 KB |
Output is correct |
47 |
Correct |
13 ms |
6912 KB |
Output is correct |
48 |
Correct |
14 ms |
6912 KB |
Output is correct |
49 |
Correct |
13 ms |
6912 KB |
Output is correct |
50 |
Correct |
13 ms |
6912 KB |
Output is correct |
51 |
Correct |
13 ms |
6912 KB |
Output is correct |
52 |
Correct |
13 ms |
6912 KB |
Output is correct |
53 |
Correct |
13 ms |
6912 KB |
Output is correct |
54 |
Correct |
13 ms |
6912 KB |
Output is correct |
55 |
Correct |
14 ms |
6912 KB |
Output is correct |
56 |
Correct |
13 ms |
6912 KB |
Output is correct |
57 |
Correct |
16 ms |
6912 KB |
Output is correct |
58 |
Correct |
13 ms |
6912 KB |
Output is correct |
59 |
Correct |
14 ms |
6912 KB |
Output is correct |
60 |
Correct |
14 ms |
6912 KB |
Output is correct |
61 |
Correct |
14 ms |
6912 KB |
Output is correct |
62 |
Correct |
14 ms |
6912 KB |
Output is correct |
63 |
Correct |
14 ms |
6912 KB |
Output is correct |
64 |
Correct |
15 ms |
6912 KB |
Output is correct |
65 |
Correct |
15 ms |
6912 KB |
Output is correct |
66 |
Correct |
14 ms |
6912 KB |
Output is correct |
67 |
Correct |
14 ms |
6912 KB |
Output is correct |
68 |
Correct |
14 ms |
6912 KB |
Output is correct |
69 |
Correct |
14 ms |
6912 KB |
Output is correct |
70 |
Correct |
15 ms |
6912 KB |
Output is correct |
71 |
Correct |
17 ms |
6912 KB |
Output is correct |
72 |
Correct |
14 ms |
6912 KB |
Output is correct |
73 |
Correct |
14 ms |
6912 KB |
Output is correct |
74 |
Correct |
14 ms |
6912 KB |
Output is correct |
75 |
Correct |
17 ms |
6912 KB |
Output is correct |
76 |
Correct |
14 ms |
6912 KB |
Output is correct |
77 |
Correct |
15 ms |
7168 KB |
Output is correct |
78 |
Correct |
15 ms |
6912 KB |
Output is correct |
79 |
Correct |
14 ms |
6912 KB |
Output is correct |
80 |
Correct |
14 ms |
6912 KB |
Output is correct |
81 |
Correct |
14 ms |
6912 KB |
Output is correct |
82 |
Correct |
16 ms |
6912 KB |
Output is correct |
83 |
Correct |
13 ms |
6912 KB |
Output is correct |
84 |
Correct |
14 ms |
6912 KB |
Output is correct |
85 |
Correct |
14 ms |
6912 KB |
Output is correct |
86 |
Correct |
15 ms |
6912 KB |
Output is correct |
87 |
Correct |
13 ms |
6912 KB |
Output is correct |
88 |
Correct |
15 ms |
6912 KB |
Output is correct |
89 |
Correct |
14 ms |
6912 KB |
Output is correct |
90 |
Correct |
15 ms |
6912 KB |
Output is correct |
91 |
Correct |
15 ms |
6912 KB |
Output is correct |
92 |
Correct |
15 ms |
6912 KB |
Output is correct |
93 |
Correct |
14 ms |
6912 KB |
Output is correct |
94 |
Correct |
15 ms |
6912 KB |
Output is correct |
95 |
Correct |
15 ms |
6912 KB |
Output is correct |
96 |
Correct |
14 ms |
6912 KB |
Output is correct |
97 |
Correct |
15 ms |
6912 KB |
Output is correct |
98 |
Correct |
18 ms |
6912 KB |
Output is correct |
99 |
Correct |
14 ms |
6912 KB |
Output is correct |
100 |
Correct |
14 ms |
6912 KB |
Output is correct |
101 |
Correct |
14 ms |
6912 KB |
Output is correct |
102 |
Correct |
15 ms |
6912 KB |
Output is correct |
103 |
Correct |
17 ms |
6912 KB |
Output is correct |
104 |
Correct |
14 ms |
6912 KB |
Output is correct |
105 |
Correct |
14 ms |
6912 KB |
Output is correct |
106 |
Correct |
14 ms |
6912 KB |
Output is correct |
107 |
Correct |
14 ms |
6912 KB |
Output is correct |
108 |
Correct |
15 ms |
6912 KB |
Output is correct |
109 |
Correct |
14 ms |
6912 KB |
Output is correct |
110 |
Correct |
13 ms |
6912 KB |
Output is correct |
111 |
Correct |
13 ms |
6912 KB |
Output is correct |
112 |
Correct |
13 ms |
6912 KB |
Output is correct |
113 |
Correct |
13 ms |
6912 KB |
Output is correct |
114 |
Correct |
13 ms |
6912 KB |
Output is correct |
115 |
Correct |
14 ms |
6912 KB |
Output is correct |
116 |
Correct |
13 ms |
6912 KB |
Output is correct |
117 |
Correct |
14 ms |
6912 KB |
Output is correct |
118 |
Correct |
16 ms |
6912 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
398 ms |
7416 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |