Submission #98051

# Submission time Handle Problem Language Result Execution time Memory
98051 2019-02-20T04:48:18 Z dndhk None (JOI16_snowy) C++14
20 / 100
20 ms 1448 KB
#include "Anyalib.h"
#include <bits/stdc++.h>

using namespace std;

static int getL;
static const int MAX_N = 100;
static vector<int> gp[MAX_N+1];
static vector<pair<int, int> > edge; 
static int p[MAX_N+1];
static int n;

static void dfs(int x){
	for(auto i : gp[x]){
		if(i==p[x])	continue;
		p[i] = x; dfs(i);
	}
}

void InitAnya(int N , int A[] , int B[]) {
	n = N;
	for(int i=0; i<N-1; i++){
		edge.push_back({A[i], B[i]});
		gp[A[i]].push_back(B[i]); gp[B[i]].push_back(A[i]);
	}
	dfs(0);
}

static int cnt[MAX_N+1];
static void dfs2(int x){
	if(x!=0){
		cnt[x]+=cnt[p[x]];
	}
	for(auto i:gp[x]){
		if(i==p[x])	continue;
		dfs2(i);
	}
}

void Anya(int C[]) {
	for(int i=0; i<n; i++)	cnt[i] = 0;
	for(int i=0; i<edge.size(); i++){
		if(C[i]){
			if(p[edge[i].first] == edge[i].second)	cnt[edge[i].first]++;
			else cnt[edge[i].second]++;
		}
	}
	dfs2(0);
	for(int i=0; i<n; i++){
		for(int j=0; j<10; j++){
			Save(i*10+j, cnt[i]%2); cnt[i]/=2;
		}
	}
}
#include "Borislib.h"

void InitBoris(int N , int A[] , int B[]) {
  
}

int Boris(int city) {
	int ans = 0;
	int two = 1;
	for(int i=0; i<10; i++){
		ans += Ask(city*10+i) * two;
		two*=2;
	}
 	return ans;
}

Compilation message

Anya.cpp: In function 'void Anya(int*)':
Anya.cpp:42:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<edge.size(); i++){
               ~^~~~~~~~~~~~
Anya.cpp: At global scope:
Anya.cpp:6:12: warning: 'getL' defined but not used [-Wunused-variable]
 static int getL;
            ^~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 780 KB Output is correct
2 Correct 5 ms 856 KB Output is correct
3 Correct 9 ms 860 KB Output is correct
4 Correct 7 ms 1100 KB Output is correct
5 Correct 11 ms 1280 KB Output is correct
6 Correct 13 ms 1324 KB Output is correct
7 Correct 12 ms 1300 KB Output is correct
8 Correct 12 ms 1364 KB Output is correct
9 Correct 11 ms 1280 KB Output is correct
10 Correct 11 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1280 KB Output is correct
2 Correct 18 ms 1280 KB Output is correct
3 Correct 16 ms 1280 KB Output is correct
4 Correct 16 ms 1388 KB Output is correct
5 Correct 17 ms 1280 KB Output is correct
6 Correct 15 ms 1280 KB Output is correct
7 Correct 17 ms 1448 KB Output is correct
8 Correct 17 ms 1296 KB Output is correct
9 Correct 14 ms 1292 KB Output is correct
10 Correct 20 ms 1280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -