#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
for (int i=0;i<N;i++) MessageBoard(i,bool(X&(1LL<<(i%60))));
return;
}
#include "Ioi.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int NN=1e4+5;
vector<int> adj[NN];
int n,m,calc=1,dis[NN][NN];
long long X=0;
bool vis[NN],calced[60],viss[NN][NN];
void dfs(int node,int p){
vis[node]=true;
if (calc==60) return;
for (auto u:adj[node]){
if (vis[u]) continue;
if (!calced[u%60]){
calced[u%60]=1;
calc++;
}
int y=Move(u);
if (y) X|=(1LL<<(u%60));
dfs(u,node);
if (calc==60) return;
}
if (p!=-1){
int y=Move(p);
if (y) X|=(1LL<<(p%60));
}
return;
}
void bfs(int s){
queue<int> q;q.push(s);viss[s][s]=true;
while (!q.empty()){
int x=q.front();
q.pop();
for (auto u:adj[x]){
if (viss[s][u]) continue;
dis[s][u]=dis[s][x]+1;
viss[s][u]=true;
q.push(u);
}
}return;
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
n=N,m=M;
for (int i=0;i<m;i++){
adj[A[i]].pb(B[i]);
adj[B[i]].pb(A[i]);
}
for (int i=0;i<n;i++) bfs(i);
if (V) X|=(1LL<<(P%60));
calced[P%60]=true;
dfs(P,-1);
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3356 KB |
Output is correct |
2 |
Correct |
2 ms |
3860 KB |
Output is correct |
3 |
Correct |
3 ms |
6688 KB |
Output is correct |
4 |
Correct |
2 ms |
3600 KB |
Output is correct |
5 |
Correct |
2 ms |
3600 KB |
Output is correct |
6 |
Correct |
2 ms |
3852 KB |
Output is correct |
7 |
Correct |
4 ms |
6688 KB |
Output is correct |
8 |
Correct |
3 ms |
6944 KB |
Output is correct |
9 |
Correct |
3 ms |
6688 KB |
Output is correct |
10 |
Correct |
1 ms |
3856 KB |
Output is correct |
11 |
Correct |
5 ms |
3908 KB |
Output is correct |
12 |
Correct |
1 ms |
3352 KB |
Output is correct |
13 |
Correct |
4 ms |
6680 KB |
Output is correct |
14 |
Correct |
4 ms |
6672 KB |
Output is correct |
15 |
Correct |
4 ms |
6672 KB |
Output is correct |
16 |
Correct |
4 ms |
6684 KB |
Output is correct |
17 |
Correct |
3 ms |
6680 KB |
Output is correct |
18 |
Correct |
3 ms |
6680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1790 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
3616 KB |
Output is correct |
2 |
Correct |
2 ms |
3612 KB |
Output is correct |
3 |
Correct |
2 ms |
3612 KB |
Output is correct |
4 |
Correct |
29 ms |
42472 KB |
Output is correct |
5 |
Correct |
28 ms |
42460 KB |
Output is correct |
6 |
Correct |
28 ms |
42464 KB |
Output is correct |
7 |
Correct |
28 ms |
42256 KB |
Output is correct |
8 |
Correct |
28 ms |
42468 KB |
Output is correct |
9 |
Runtime error |
386 ms |
262144 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1760 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1743 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |