#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
/* sorry, this is the bare minimum :'( */
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second
const int N = 1e5 + 5;
namespace {
int vis[N];
int cnt = 0;
int rnk[N];
vi g[N];
void dfs(int u) {
vis[u] = 1;
rnk[u] = cnt++;
for(int v : g[u]) if(!vis[v]) {
dfs(v);
}
}
}
void Joi(int n, int m, int A[], int B[], long long X, int T) {
for(int i = 0; i < m; ++i) {
g[A[i]].emplace_back(B[i]);
g[B[i]].emplace_back(A[i]);
}
dfs(0);
for(int i = 0; i < n; ++i) {
MessageBoard(i, X >> (rnk[i] % 60) & 1);
}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
/* sorry, this is the bare minimum :'( */
using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
#define all(v) begin(v), end(v)
#define sz(v) (int)(v).size()
#define fi first
#define se second
const int N = 1e5 + 5;
namespace {
vi g[N];
int vis[N], rnk[N];
int cnt = 0;
vi tour;
void dfs(int u) {
vis[u] = 1;
rnk[u] = cnt++;
tour.emplace_back(u);
for(int v : g[u]) if(!vis[v]) {
dfs(v);
tour.emplace_back(u);
}
}
}
long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
for(int i = 0; i < m; ++i) {
g[A[i]].emplace_back(B[i]);
g[B[i]].emplace_back(A[i]);
}
memset(vis, 0, sizeof vis);
dfs(0);
tour.pop_back();
ll ret = ll(V) << (rnk[P] % 60);
int st = int(find(all(tour), P) - tour.begin());
for(int _ = 0, i = (st+1) % sz(tour); _ < 120; i = (i+1) % sz(tour), ++_) {
ret |= ll(Move(tour[i])) << (rnk[tour[i]] % 60);
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
5860 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
8900 KB |
Output is correct |
2 |
Correct |
30 ms |
9156 KB |
Output is correct |
3 |
Correct |
30 ms |
8900 KB |
Output is correct |
4 |
Correct |
23 ms |
7468 KB |
Output is correct |
5 |
Incorrect |
24 ms |
7980 KB |
Wrong Answer [7] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
5888 KB |
Output is correct |
2 |
Correct |
4 ms |
5860 KB |
Output is correct |
3 |
Correct |
4 ms |
5860 KB |
Output is correct |
4 |
Correct |
6 ms |
6280 KB |
Output is correct |
5 |
Correct |
6 ms |
6288 KB |
Output is correct |
6 |
Correct |
6 ms |
6288 KB |
Output is correct |
7 |
Correct |
7 ms |
6288 KB |
Output is correct |
8 |
Correct |
6 ms |
6228 KB |
Output is correct |
9 |
Correct |
16 ms |
8492 KB |
Output is correct |
10 |
Correct |
16 ms |
8492 KB |
Output is correct |
11 |
Correct |
16 ms |
8620 KB |
Output is correct |
12 |
Correct |
4 ms |
5912 KB |
Output is correct |
13 |
Correct |
4 ms |
5900 KB |
Output is correct |
14 |
Correct |
4 ms |
5864 KB |
Output is correct |
15 |
Correct |
4 ms |
5876 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
9284 KB |
Output is correct |
2 |
Incorrect |
31 ms |
9364 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
9220 KB |
Output is correct |
2 |
Correct |
28 ms |
9156 KB |
Output is correct |
3 |
Incorrect |
31 ms |
9500 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |