#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void Joi(int n, int m, int a[], int b[], ll x, int T){
if(T == 1){
for(int i = 0; i < 60; i++){
MessageBoard(i, bool(1LL << i & x));
}
for(int i = 60; i < n; i++){
MessageBoard(i, 0);
}
}
else if(T == 3){
for(int i = 0; i < n; i++){
MessageBoard(i, bool(1LL << (i % 60) & x));
}
}
}
#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll Ioi(int n, int m, int a[], int b[], int p, int V, int T){
vector<vector<int>>g(n);
for(int i = 0; i < m; i++){
g[a[i]].emplace_back(b[i]);
g[b[i]].emplace_back(a[i]);
}
if(T == 1){
ll ans = 0;
vector<int>path, need_path;
vector<bool>vis(n);
function<void(int, const int)>dfs;
dfs = [&] (int s, const int destination){
path.emplace_back(s);
if(s == destination){
need_path = path;
}
vis[s] = true;
for(int& d : g[s]){
if(!vis[d]){
dfs(d, destination);
}
}
path.pop_back();
};
for(int i = 0; i < 60; i++){
fill(vis.begin(), vis.end(), false);
dfs(p, i);
for(int j = 1; j < need_path.size(); j++){
V = Move(p = need_path[j]);
}
if(V == 1){
ans |= 1LL << i;
}
}
return ans;
}
else if(T == 3){
while(p + 1 < n && p % 60 != 59){
V = Move(++p);
}
while(p % 60 != 59){
V = Move(--p);
}
ll ans = (V == 1 ? (1LL << 59) : 0);
for(int i = 58; i > -1; i--){
V = Move(--p);
if(V == 1){
ans |= 1LL << i;
}
}
return ans;
}
return 1;
}
# | 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... |