# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
257379 |
2020-08-04T07:48:21 Z |
송준혁(#5061) |
None (JOI16_snowy) |
C++14 |
|
31 ms |
3624 KB |
#include "Anyalib.h"
#include <bits/stdc++.h>
using namespace std;
static int N, D[550], S[550], P[550];
static int A[550], B[550], C[550][550];
static vector<int> adj[550];
static void dfs(int u, int p, int d, int c){
D[u] = d, P[u] = c;
for (int v : adj[u]){
if (v == p) continue;
dfs(v, u, d+1, c+C[u][v]);
}
}
void InitAnya(int n, int a[], int b[]) {
N=n;
for (int i=0; i<N; i++) adj[i].clear();
for (int i=0; i<N-1; i++){
A[i] = a[i], B[i] = b[i];
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
}
void Anya(int c[]) {
memset(C, 0, sizeof C);
for (int i=0; i<N-1; i++) C[A[i]][B[i]] = C[B[i]][A[i]] = c[i];
dfs(0, -1, 0, 0);
memset(S, 0, sizeof S);
for (int i=1; i<N; i++){
int t=0;
while ((1<<t)-1 < D[i]) t++;
D[i] = t;
S[i] = D[i] + S[i-1];
}
for (int i=1; i<N; i++){
for (int j=0; j<D[i]; j++) Save(S[i-1]+j, !!(P[i]&(1<<j)));
}
}
#include "Borislib.h"
#include <bits/stdc++.h>
using namespace std;
static int N, D[550], S[550];
static int A[550], B[550];
static vector<int> adj[550];
static void dfs(int u, int p, int d){
D[u] = d;
for (int v : adj[u]){
if (v == p) continue;
dfs(v, u, d+1);
}
}
void InitBoris(int n, int a[], int b[]) {
N=n;
memset(S, 0, sizeof S);
for (int i=0; i<N; i++) adj[i].clear();
for (int i=0; i<N-1; i++){
A[i] = a[i], B[i] = b[i];
adj[A[i]].push_back(B[i]);
adj[B[i]].push_back(A[i]);
}
dfs(0, -1, 0);
for (int i=1; i<N; i++){
int t=0;
while ((1<<t)-1 < D[i]) t++;
D[i] = t;
S[i] = S[i-1] + D[i];
}
}
int Boris(int city){
int r=0;
for (int j=0; j<D[city]; j++) if (Ask(S[city-1]+j)) r |= (1<<j);
return r;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3072 KB |
Output is correct |
2 |
Correct |
3 ms |
3072 KB |
Output is correct |
3 |
Correct |
9 ms |
3328 KB |
Output is correct |
4 |
Correct |
15 ms |
3328 KB |
Output is correct |
5 |
Correct |
24 ms |
3568 KB |
Output is correct |
6 |
Correct |
24 ms |
3584 KB |
Output is correct |
7 |
Correct |
24 ms |
3568 KB |
Output is correct |
8 |
Correct |
24 ms |
3568 KB |
Output is correct |
9 |
Correct |
26 ms |
3584 KB |
Output is correct |
10 |
Correct |
27 ms |
3584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3504 KB |
Output is correct |
2 |
Correct |
30 ms |
3544 KB |
Output is correct |
3 |
Correct |
28 ms |
3584 KB |
Output is correct |
4 |
Correct |
27 ms |
3584 KB |
Output is correct |
5 |
Correct |
28 ms |
3624 KB |
Output is correct |
6 |
Correct |
28 ms |
3584 KB |
Output is correct |
7 |
Correct |
28 ms |
3584 KB |
Output is correct |
8 |
Correct |
28 ms |
3584 KB |
Output is correct |
9 |
Correct |
31 ms |
3568 KB |
Output is correct |
10 |
Correct |
28 ms |
3584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
3328 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
3072 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |