#include <bits/stdc++.h>
#include "Joi.h"
#pragma GCC target("sse,sse2,avx2")
#pragma GCC optimize("unroll-loops,O3")
#define rep(i,l,r) for (int i = l; i < r; i++)
#define repr(i,r,l) for (int i = r; i >= l; i--)
#define X first
#define Y second
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define endl '\n'
#define debug(x) cerr << #x << " : " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pll;
constexpr int N = 1e6+10,mod = 1e9+7;
vector<int> aadj[N];
int TT,ttin[N];
bool vvis[N];
void dfs(int v,ll x){
if ((x&(1ll << (TT%60)))) MessageBoard(v,1);
else MessageBoard(v,0);
ttin[v] = TT++;
vvis[v] = 1;
for (int u : aadj[v]) if (!vvis[u]) dfs(u,x);
}
void Joi(int n, int m, int A[], int B[], long long x, int tt) {
rep(i,0,m){
aadj[A[i]].pb(B[i]);
aadj[B[i]].pb(A[i]);
}
rep(i,0,n) sort(all(aadj[i]));
dfs(0,x);
return;
}
#include "Ioi.h"
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,avx2")
#pragma GCC optimize("unroll-loops,O3")
#define rep(i,l,r) for (int i = l; i < r; i++)
#define repr(i,r,l) for (int i = r; i >= l; i--)
#define X first
#define Y second
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define endl '\n'
#define debug(x) cerr << #x << " : " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> pll;
constexpr int N = 1e6+10,mod = 1e9+7;
constexpr ll inf = 1e9+10;
vector<int> adj[N];
bool vis[N];
int tin[N],T;
int par[N],ans[70];
int po[N];
void dfs(int v){
vis[v] = 1;
tin[v] = T++;
for (int u : adj[v]) if (!vis[u]){
par[u] = v;
dfs(u);
}
}
long long Ioi(int n, int m, int A[], int B[], int P, int v, int tt) {
rep(i,0,m){
adj[A[i]].pb(B[i]);
adj[B[i]].pb(A[i]);
}
rep(i,0,n) sort(all(adj[i]));
dfs(0);
memset(ans,-1,sizeof ans);
swap(P,v);
int cur = v;
ans[tin[cur]%60] = P;
int cnt = 1;
while (cnt < 60){
int fl = -1;
int sz = adj[cur].size();
while (po[cur] < sz){
int u = adj[cur][po[cur]];
po[cur]++;
if (u == par[cur]) continue;
if (ans[tin[u]%60] != -1) continue;
fl = u;
}
if (fl == -1)
fl = par[cur];
int t = tin[fl]%60;
if (ans[t] == -1) cnt++;
ans[t] = Move(fl);
cur = fl;
}
ll out = 0;
rep(i,0,60) if (ans[i]) out += (1ll << i);
return out;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
47668 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
48 ms |
50572 KB |
Output is correct |
2 |
Correct |
50 ms |
50608 KB |
Output is correct |
3 |
Correct |
49 ms |
50488 KB |
Output is correct |
4 |
Incorrect |
37 ms |
49480 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
47672 KB |
Output is correct |
2 |
Correct |
27 ms |
47648 KB |
Output is correct |
3 |
Correct |
26 ms |
47656 KB |
Output is correct |
4 |
Correct |
28 ms |
47844 KB |
Output is correct |
5 |
Correct |
27 ms |
48020 KB |
Output is correct |
6 |
Correct |
27 ms |
47964 KB |
Output is correct |
7 |
Correct |
27 ms |
47964 KB |
Output is correct |
8 |
Correct |
27 ms |
47956 KB |
Output is correct |
9 |
Correct |
34 ms |
49720 KB |
Output is correct |
10 |
Correct |
35 ms |
50032 KB |
Output is correct |
11 |
Correct |
35 ms |
49876 KB |
Output is correct |
12 |
Correct |
26 ms |
47648 KB |
Output is correct |
13 |
Correct |
26 ms |
47716 KB |
Output is correct |
14 |
Correct |
28 ms |
47668 KB |
Output is correct |
15 |
Correct |
30 ms |
47648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
53 ms |
50612 KB |
Partially correct |
2 |
Correct |
50 ms |
50536 KB |
Output is correct |
3 |
Correct |
47 ms |
50720 KB |
Output is correct |
4 |
Incorrect |
37 ms |
49308 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
52 ms |
50540 KB |
Output is correct |
2 |
Correct |
48 ms |
50528 KB |
Output is correct |
3 |
Correct |
50 ms |
50492 KB |
Output is correct |
4 |
Incorrect |
43 ms |
49520 KB |
Wrong Answer [7] |
5 |
Halted |
0 ms |
0 KB |
- |