#include "Anyalib.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
static int getL;
int nn;
vector<pii> linkk[510];
pii edgg[510];
void InitAnya(int N, int A[], int B[]){
nn=N;
for(int i=0; i<nn-1; i++){
edgg[i+1]=mp(A[i], B[i]);
linkk[A[i]].eb(B[i], i+1);
linkk[B[i]].eb(A[i], i+1);
}
}
void Anya(int C[]){
for(int i=0; i<nn-1; i++)Save(i+1 , C[i]);
}
#include "Borislib.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int n;
vector<pii> link[510];
pii edg[510];
int dis[510], cnt[510];
void InitBoris(int N, int A[], int B[]){
n=N;
for(int i=0; i<n-1; i++){
edg[i+1]=mp(A[i], B[i]);
link[A[i]].eb(B[i], i+1);
link[B[i]].eb(A[i], i+1);
}
}
void dfs(int num, int par, int d){
dis[num]=d;
for(auto i:link[num]){
if(i.F==par)continue;
dfs(i.F, num, d+cnt[i.S]);
}
}
int Boris(int city){
for(int i=1; i<n; i++)cnt[i]=Ask(i);
dfs(0, -1, 0);
return dis[city];
}
Compilation message
Anya.cpp:10:12: warning: 'getL' defined but not used [-Wunused-variable]
static int getL;
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
944 KB |
Output is correct |
2 |
Correct |
2 ms |
916 KB |
Output is correct |
3 |
Correct |
3 ms |
832 KB |
Output is correct |
4 |
Correct |
4 ms |
1116 KB |
Output is correct |
5 |
Correct |
6 ms |
1176 KB |
Output is correct |
6 |
Correct |
7 ms |
1048 KB |
Output is correct |
7 |
Correct |
6 ms |
1184 KB |
Output is correct |
8 |
Correct |
7 ms |
1184 KB |
Output is correct |
9 |
Correct |
6 ms |
1048 KB |
Output is correct |
10 |
Correct |
6 ms |
1176 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
1184 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1280 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1280 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |