#include "Anyalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static const int MAXN = 500;
static int N;
static vector<pii> adj[MAXN+10];
static pii E[MAXN+10];
static int C[MAXN+10], A[MAXN+10];
void dfs(int now, int bef, int d)
{
A[now]=d;
for(auto nxt : adj[now])
{
if(nxt.first==bef) continue;
dfs(nxt.first, now, d+C[nxt.second]);
}
}
void InitAnya(int _N, int A[], int B[])
{
N=_N;
for(int i=1; i<N; i++)
{
int u=A[i-1]+1, v=B[i-1]+1;
adj[u].push_back({v, i});
adj[v].push_back({u, i});
E[i]={u, v};
}
}
void Anya(int _C[])
{
for(int i=1; i<N; i++) C[i]=_C[i-1];
dfs(1, 1, 0);
for(int i=1; i<=N; i++)
{
for(int j=0; j<10; j++)
{
if(A[i]&(1<<j)) Save((i-1)*10+j, 1);
}
}
}
#include "Borislib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static const int MAXN = 500;
static int N;
static vector<int> adj[MAXN+10];
static pii E[MAXN+10];
static int C[MAXN+10];
void InitBoris(int _N, int A[], int B[])
{
N=_N;
for(int i=1; i<N; i++)
{
int u=A[i-1]+1, v=B[i-1]+1;
adj[u].push_back(v);
adj[v].push_back(u);
E[i]={u, v};
}
}
int Boris(int city)
{
int ret=0;
for(int i=0; i<10; i++)
{
ret|=(Ask(city*10+i)<<i);
}
return ret;
}
Compilation message
Boris.cpp:14:12: warning: 'C' defined but not used [-Wunused-variable]
static int C[MAXN+10];
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1004 KB |
Output is correct |
2 |
Correct |
2 ms |
792 KB |
Output is correct |
3 |
Correct |
4 ms |
1236 KB |
Output is correct |
4 |
Correct |
6 ms |
1216 KB |
Output is correct |
5 |
Correct |
7 ms |
1280 KB |
Output is correct |
6 |
Correct |
7 ms |
1440 KB |
Output is correct |
7 |
Correct |
7 ms |
1436 KB |
Output is correct |
8 |
Correct |
7 ms |
1280 KB |
Output is correct |
9 |
Correct |
7 ms |
1444 KB |
Output is correct |
10 |
Correct |
7 ms |
1280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1444 KB |
Output is correct |
2 |
Correct |
9 ms |
1376 KB |
Output is correct |
3 |
Correct |
12 ms |
1440 KB |
Output is correct |
4 |
Correct |
10 ms |
1444 KB |
Output is correct |
5 |
Correct |
11 ms |
1280 KB |
Output is correct |
6 |
Correct |
11 ms |
1280 KB |
Output is correct |
7 |
Correct |
11 ms |
1280 KB |
Output is correct |
8 |
Correct |
11 ms |
1444 KB |
Output is correct |
9 |
Correct |
11 ms |
1280 KB |
Output is correct |
10 |
Correct |
11 ms |
1448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
976 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
948 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |