#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100
namespace JOI {
int n, m;
int a[MAXN], b[MAXN];
ll x;
int t;
vector<int> g[MAXN];
int tt = 0;
int bio[MAXN];
int usao[MAXN];
void dfs(int cv, int rod)
{
if (bio[cv]) return;
bio[cv] = 1;
usao[cv] = tt;
tt++;
MessageBoard(cv, !!(x & (1LL << ll(usao[cv] % 60))));
for (int i: g[cv]) {
if (rod != i) {
dfs(i, cv);
}
}
}
}
using namespace JOI;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
n = N; m = M; x = X; t = T;
for(int i = 0; i < N; i++){
//MessageBoard(i, 0);
}
for (int i = 0; i < m; i++) {
a[i] = A[i];
b[i] = B[i];
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
for (int i = 0; i < n; i++) reverse(g[i].begin(), g[i].end());
dfs(0, -1);
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100
namespace IOI {
int n, m;
int a[MAXN], b[MAXN], par[MAXN];
int p, v;
int t;
vector<int> g[MAXN];
int tt = 0;
int bio[MAXN];
int usao[MAXN];
ll reza = 0LL;
int done[100], cnt = 0;
void dfs(int cv, int rod)
{
if (bio[cv]) return;
bio[cv] = 1;
usao[cv] = tt;
tt++;
par[cv] = rod;
for (int i: g[cv]) {
if (rod != i) {
dfs(i, cv);
}
}
}
void dfs2(int cv, int msg, int isrt)
{
bio[cv] = 1;
int cu = usao[cv] % 60;
if (!done[cu]) {
cnt++;cout<<cv<<' '<<usao[cv]<<'.'<<cnt<<endl;
done[cu] = 1;
reza |= ll(msg) * (1LL << ll(cu));
}
if (cnt == 60) return;
for (int i: g[cv]) {
if (i == par[cv]) continue;
if (bio[i]) continue;
dfs2(i, Move(i), 0);
if (cnt == 60) return;
}
if (par[cv] != -1
//&& isrt
)
{
dfs2(par[cv], Move(par[cv]), 1);
}
}
}
using namespace IOI;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
n = N; m = M; p = P; v = V; t = T;
for (int i = 0; i < m; i++) {
a[i] = A[i];
b[i] = B[i];
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
for (int i = 0; i < n; i++) reverse(g[i].begin(), g[i].end());
dfs(0, -1);
memset(bio, 0, sizeof bio);
dfs2(p, v, 1);
//return 0LL;
return reza;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1804 KB |
Do not print anything on standard output. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
5412 KB |
Do not print anything on standard output. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1800 KB |
Do not print anything on standard output. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
5420 KB |
Do not print anything on standard output. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
5660 KB |
Do not print anything on standard output. |
2 |
Halted |
0 ms |
0 KB |
- |