이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
static const int MAXN = 10013;
static int N;
static vi edge[MAXN];
static int dsu[MAXN];
static int get(int u)
{
return (u == dsu[u] ? u : dsu[u] = get(dsu[u]));
}
static bool merge(int u, int v)
{
u = get(u);
v = get(v);
if (u == v)
{
return false;
}
dsu[u] = v;
return true;
}
void Joi(int n, int m, int e1[], int e2[], ll val, int subtask)
{
N = n;
iota(dsu, dsu + N, 0);
FOR(i, 0, m)
{
int u = e1[i], v = e2[i];
if (merge(u, v))
{
edge[u].PB(v);
edge[v].PB(u);
// cerr << "edge " << u << ' ' << v << endl;
}
}
// cerr << "ALIVE\n";
FOR(i, 0, N)
{
int cur = 0;
if (i < 60 && (val & (1ll << i)) > 0)
{
cur = 1;
}
// cerr << "message " << i << ' ' << cur << endl;
MessageBoard(i, cur);
}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
static const int MAXN = 10013;
static int N;
static vi edge[MAXN];
static int dsu[MAXN];
static bool val[MAXN];
static ll ans;
static int get(int u)
{
return (u == dsu[u] ? u : dsu[u] = get(dsu[u]));
}
static bool merge(int u, int v)
{
u = get(u);
v = get(v);
if (u == v)
{
return false;
}
dsu[u] = v;
return true;
}
void dfs(int u, int p)
{
for (int v : edge[u])
{
if (v == p) continue;
val[v] = Move(v);
dfs(v, u);
Move(u);
}
}
ll Ioi(int n, int m, int e1[], int e2[], int st, int va, int subtask)
{
N = n;
iota(dsu, dsu + N, 0);
FOR(i, 0, m)
{
int u = e1[i], v = e2[i];
if (merge(u, v))
{
edge[u].PB(v);
edge[v].PB(u);
// cerr << "edge " << u << ' ' << v << endl;
}
}
val[st] = va;
dfs(st, N);
FOR(i, 0, 60)
{
if (val[i])
{
ans += (1ll << i);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |