#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int i_inf = 1e9;
const ll inf = 1e17;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi = 3.14159265359;
mt19937 _rand(time(NULL));
clock_t timer = clock();
const int mxn = 1e5;
#include "Joi.h"
/*int VAL[mxn];
void MessageBoard(int u, int val){
VAL[u] = val;
return;
}*/
int n, m;
int a[mxn], b[mxn];
bool vis[mxn];
vector<int> g[mxn];
int itopos[mxn];
int temp_p = 0;
void dfs(int u){
itopos[u] = temp_p++;
vis[u] = true;
for(auto e : g[u]){
if(vis[e]) continue;
dfs(e);
}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
n = N, m = M;
fr(i, 0, m) a[i] = A[i], b[i] = B[i];
fr(i, 0, m){
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
dfs(0);
fr(i, 0, n){
if(X&(1LL<<(itopos[i]%60))) MessageBoard(i,1);
else MessageBoard(i,0);
}
}
#include <bits/stdc++.h>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int i_inf = 1e9;
const ll inf = 1e17;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi = 3.14159265359;
mt19937 _rand(time(NULL));
clock_t timer = clock();
const int mxn = 1e5;
#include "Ioi.h"
/*
int mark[60] = {1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int Move(int u){
cout<<u<<endl;
return mark[u];
}*/
int n, m;
int a[mxn], b[mxn];
bool vis[mxn];
vector<int> g[mxn];
int postoi[mxn];
int temp_p = 0;
vector<int> v;
int val[mxn];
int parent[mxn];
void dfs(int u, int p){
parent[u] = p;
postoi[temp_p++] = u;
vis[u] = true;
for(auto e : g[u]){
if(vis[e]) continue;
dfs(e, u);
}
}
int loc_pos;
void dfs2(int u, int p){
if(loc_pos > 200) return;
vis[u] = true;
for(auto e : g[u]){
if(vis[e]) continue;
val[e] = Move(e);
++loc_pos;
if(loc_pos > 200) return;
dfs2(e, u);
}
if(loc_pos > 200) return;
if(u != p) Move(parent[u]);
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
n = N, m = M;
fr(i, 0, m) a[i] = A[i], b[i] = B[i];
fr(i, 0, m){
g[a[i]].pb(b[i]);
g[b[i]].pb(a[i]);
}
dfs(0, 0);
loc_pos = 1;
while(P != 0) V = Move(parent[P]), P = parent[P];
val[0] = V;
memset(vis, false, sizeof(vis));
dfs2(0, 0);
ll X = 0;
fr(i, 0, 60){
X |= (1LL<<i)*val[postoi[i]];
}
return X;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
5820 KB |
Output is correct |
2 |
Correct |
4 ms |
5700 KB |
Output is correct |
3 |
Incorrect |
4 ms |
5684 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
8964 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
5688 KB |
Output is correct |
2 |
Correct |
4 ms |
5640 KB |
Output is correct |
3 |
Incorrect |
4 ms |
5692 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
32 ms |
9268 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
9100 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |