#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;
const int MAXN2 = (int)2e5+228;
int val2[MAXN2], used2[MAXN2];
vector < int > g2[MAXN2];
long long tmp, XX;
void dfs2(int v, int len = 0) {
used2[v] = 1;
if(len < 60) {
val2[v] = (bool)((1ll << len*1ll) & XX);
MessageBoard(v, val2[v]);
} else {
val2[v] = 0;
MessageBoard(v, val2[v]);
}
for(auto &to : g2[v]) {
if(!used2[to]) dfs2(to, len+1);
}
}
void Joi(int n, int m, int A[], int B[], long long X, int T) {
for(int i = 0; i < n; i++){
val2[i] = -1; used2[i] = 0;
g2[i].clear();
}
for(int i = 0; i < m; ++i) {
g2[A[i]].push_back(B[i]);
g2[B[i]].push_back(A[i]);
}
XX = X;
dfs2(0);
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN1 = (int)2e5+228;
bool used1[MAXN1];
vector < int > g1[MAXN1];
int val1[MAXN1], now;
long long ret = 0ll;
set < pair < int, int > > all;
void dfs1(int v) {
assert(now == v);
for(auto &to : g1[v]) {
if(val1[to] == -1) {
val1[to] = Move(to);
now = to;
dfs1(to);
assert(now == to);
assert(Move(v) == val1[v]);
now = v;
}
}
}
void dfs11(int v, int len = 0) {
used1[v] = 1;
if(len < 60) ret ^= (1ll << len*1ll) * val1[v];
for(auto &to : g1[v]) {
if(!used1[to]) {
dfs11(to, len+1);
}
}
}
long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
for(int i = 0; i < n; ++i) {
used1[i] = 0;
val1[i] = -1;
g1[i].clear();
}
val1[P] = V;
for(int i = 0; i < m; ++i) {
g1[A[i]].push_back(B[i]);
g1[B[i]].push_back(A[i]);
all.insert({A[i], B[i]});
all.insert({B[i], A[i]});
}
now = P;
ret = 0ll;
dfs1(P);
for(int i = 0; i < n; ++i) used1[i] = 0;
dfs11(0);
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
10100 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
57 ms |
14964 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
16968 KB |
Output is correct |
2 |
Correct |
11 ms |
16968 KB |
Output is correct |
3 |
Correct |
11 ms |
16968 KB |
Output is correct |
4 |
Incorrect |
16 ms |
16968 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
17236 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
68 ms |
17504 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |