#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=2; i<=N; i++) C[i]=_C[i-2];
for(int i=1; i<=500; i++)
{
A[i]=A[i-1]+C[i];
if(i%10==0)
{
for(int j=0; j<9; j++)
{
int t=i/10-1;
if(A[i]&(1<<j)) Save(t*9+j, 1);
}
}
}
for(int i=1; i<500; i++) if(C[i]) Save(i+449, 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; city++;
int t=city/10-1;
if(t>=0) for(int i=0; i<9; i++) ret+=(1<<Ask(i+t*9));
for(int i=city/10*10+1; i<=city; i++) ret+=Ask(i+449);
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 |
Incorrect |
1 ms |
796 KB |
Wrong Answer [7] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1376 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
1944 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
16 ms |
1864 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |