This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
Boris.cpp:14:12: warning: 'C' defined but not used [-Wunused-variable]
static int C[MAXN+10];
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |