답안 #259702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
259702 2020-08-08T10:23:13 Z arnold518 Snowy Roads (JOI16_snowy) C++14
35 / 100
19 ms 2076 KB
#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+=(Ask(i+t*9)<<i);
	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 1 ms 792 KB Output is correct
2 Incorrect 2 ms 796 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1344 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1960 KB Output is correct
2 Correct 16 ms 1944 KB Output is correct
3 Correct 16 ms 1944 KB Output is correct
4 Correct 16 ms 1792 KB Output is correct
5 Correct 16 ms 1804 KB Output is correct
6 Correct 16 ms 1940 KB Output is correct
7 Correct 16 ms 1948 KB Output is correct
8 Correct 16 ms 1932 KB Output is correct
9 Correct 16 ms 1948 KB Output is correct
10 Correct 16 ms 1868 KB Output is correct
11 Correct 16 ms 1936 KB Output is correct
12 Correct 19 ms 2048 KB Output is correct
13 Correct 16 ms 1932 KB Output is correct
14 Correct 16 ms 1792 KB Output is correct
15 Correct 16 ms 1936 KB Output is correct
16 Correct 16 ms 1944 KB Output is correct
17 Correct 16 ms 1792 KB Output is correct
18 Correct 16 ms 2076 KB Output is correct
19 Correct 16 ms 2048 KB Output is correct
20 Correct 16 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 1940 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -