#include "Alicelib.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
struct chash
{
int operator()(int x) const
{
x ^= (x >> 20) ^ (x >> 12);
return x ^ (x >> 7) ^ (x >> 4);
}
int operator()(long long x) const
{
return x ^ (x >> 32);
}
};
template<typename T> using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename U> using hashtable = gp_hash_table<T, U, chash>;
template<class T>
void readi(T &x)
{
T input = 0;
bool negative = false;
char c = ' ';
while (c < '-')
{
c = getchar();
}
if (c == '-')
{
negative = true;
c = getchar();
}
while (c >= '0')
{
input = input * 10 + (c - '0');
c = getchar();
}
if (negative)
{
input = -input;
}
x = input;
}
template<class T>
void printi(T output)
{
if (output == 0)
{
putchar('0');
return;
}
if (output < 0)
{
putchar('-');
output = -output;
}
int aout[20];
int ilen = 0;
while(output)
{
aout[ilen] = ((output % 10));
output /= 10;
ilen++;
}
for (int i = ilen - 1; i >= 0; i--)
{
putchar(aout[i] + '0');
}
return;
}
template<class T>
void ckmin(T &a, T b)
{
a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
a = max(a, b);
}
template<class T>
T normalize(T x, T mod = 1000000007)
{
return (((x % mod) + mod) % mod);
}
static long long randomizell(long long mod)
{
return ((1ll << 45) * rand() + (1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}
static int randomize(int mod)
{
return ((1ll << 15) * rand() + rand()) % mod;
}
#define y0 ___y0
#define y1 ___y1
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;
const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;
#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
static int N;
static vector<pii> edge, edges;
void send()
{
// for (pii x : edges)
// {
// cerr << "send " << x.fi << ' ' << x.se << endl;
// }
InitG(N + 12, edges.size());
for (int i = 0; i < edges.size(); i++)
{
MakeG(i, edges[i].fi, edges[i].se);
}
return;
}
void Alice(int n, int m, int a[], int b[])
{
N = n;
for (int i = 0; i < m; i++)
{
if (a[i] > b[i])
{
swap(a[i], b[i]);
}
edge.PB(MP(a[i], b[i]));
}
for (int i = 0; i < edge.size(); i++)
{
int u = edge[i].fi, v = edge[i].se;
edges.PB(MP(u, v));
}
for (int i = 0; i < N; i++)
{
for (int j = 0; j < 10; j++)
{
if (i & (1 << j))
{
edges.PB(MP(i, N + j));
}
}
}
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < i; j++)
{
edges.PB(MP(N + j, N + i));
}
}
for (int i = 0; i < N + 10; i++)
{
edges.PB(MP(i, N + 10));
}
//N + 10 is friends with everybody but N+11
//N+11 is friends with all the guys in the loop
for (int i = N; i < N + 10; i++)
{
edges.PB(MP(i, N + 11));
}
send();
return;
}
#include "Boblib.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
struct chash
{
int operator()(int x) const
{
x ^= (x >> 20) ^ (x >> 12);
return x ^ (x >> 7) ^ (x >> 4);
}
int operator()(long long x) const
{
return x ^ (x >> 32);
}
};
template<typename T> using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename U> using hashtable = gp_hash_table<T, U, chash>;
template<class T>
void readi(T &x)
{
T input = 0;
bool negative = false;
char c = ' ';
while (c < '-')
{
c = getchar();
}
if (c == '-')
{
negative = true;
c = getchar();
}
while (c >= '0')
{
input = input * 10 + (c - '0');
c = getchar();
}
if (negative)
{
input = -input;
}
x = input;
}
template<class T>
void printi(T output)
{
if (output == 0)
{
putchar('0');
return;
}
if (output < 0)
{
putchar('-');
output = -output;
}
int aout[20];
int ilen = 0;
while(output)
{
aout[ilen] = ((output % 10));
output /= 10;
ilen++;
}
for (int i = ilen - 1; i >= 0; i--)
{
putchar(aout[i] + '0');
}
return;
}
template<class T>
void ckmin(T &a, T b)
{
a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
a = max(a, b);
}
template<class T>
T normalize(T x, T mod = 1000000007)
{
return (((x % mod) + mod) % mod);
}
static long long randomizell(long long mod)
{
return ((1ll << 45) * rand() + (1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}
static int randomize(int mod)
{
return ((1ll << 15) * rand() + rand()) % mod;
}
#define y0 ___y0
#define y1 ___y1
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;
const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;
#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
#define MAXN 1313
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
static int N;
static vector<pii> edges, isbits;
static vector<int> edge[MAXN];
static int bt[MAXN], id[MAXN];
static bool isbit[MAXN], inlone[MAXN];
static int lone, control;
void finish()
{
// for (pii x : edges)
// {
// cerr << "solve " << x.fi << ' ' << x.se << endl;
// }
InitMap(N - 12, edges.size());
for (pii x : edges)
{
MakeMap(x.fi, x.se);
}
return;
}
void Bob(int n, int m, int a[], int b[])
{
N = n;
// if (N == 12)
// {
// finish();
// return;
// }
// if (N == 13)
// {
// finish();
// return;
// }
for (int i = 0; i < m; i++)
{
edge[b[i]].PB(a[i]);
}
int freq = 0;
for (int i = 0; i < N; i++)
{
if (edge[i].size() == N - 2)
{
lone = i;
freq++;
}
}
if (freq != 1)
{
}
// assert(freq == 1);
// cerr << "lone " << lone << endl;
for (int x : edge[lone])
{
inlone[x] = true;
}
for (int i = 0; i < N; i++)
{
if (i != lone && !inlone[i])
{
control = i;
}
}
// cerr << "control " << control << endl;
for (int x : edge[control])
{
isbits.PB(MP(x, 0));
isbit[x] = true;
// cerr << "isbit " << x << endl;
}
for (pii &p : isbits)
{
int u = p.fi;
for (int v : edge[u])
{
if (isbit[v])
{
p.se++;
}
}
bt[p.se]= u;
}
for (int i = 0; i < 10; i++)
{
int u = bt[i];
for (int v : edge[u])
{
if (isbit[v] || v == control || v == lone)
{
continue;
}
id[v] += (1 << i);
}
}
for (int u = 0; u < N; u++)
{
if (isbit[u] || u == control || u == lone)
{
continue;
}
// cerr << "id " << u << " = " << id[u] << endl;
for (int v : edge[u])
{
if (isbit[v] || v == control || v == lone)
{
continue;
}
edges.PB(MP(id[u], id[v]));
}
}
finish();
}
Compilation message
Alice.cpp: In function 'void send()':
Alice.cpp:142:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < edges.size(); i++)
~~^~~~~~~~~~~~~~
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:159:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < edge.size(); i++)
~~^~~~~~~~~~~~~
Alice.cpp: At global scope:
Alice.cpp:97:12: warning: 'int randomize(int)' defined but not used [-Wunused-function]
static int randomize(int mod)
^~~~~~~~~
Alice.cpp:93:18: warning: 'long long int randomizell(long long int)' defined but not used [-Wunused-function]
static long long randomizell(long long mod)
^~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:173:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (edge[i].size() == N - 2)
~~~~~~~~~~~~~~~^~~~~~~~
Bob.cpp: At global scope:
Bob.cpp:97:12: warning: 'int randomize(int)' defined but not used [-Wunused-function]
static int randomize(int mod)
^~~~~~~~~
Bob.cpp:93:18: warning: 'long long int randomizell(long long int)' defined but not used [-Wunused-function]
static long long randomizell(long long mod)
^~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
6640 KB |
Wrong Answer [11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
6640 KB |
Wrong Answer [11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
738 ms |
38672 KB |
Wrong Answer [11] |
2 |
Halted |
0 ms |
0 KB |
- |