답안 #41811

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41811 2018-02-21T09:24:52 Z cmaster Amusement Park (JOI17_amusement_park) C++14
0 / 100
38 ms 13656 KB
#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;
static const int MAXN2 = (int)2e5+228;
static int val2[MAXN2], used2[MAXN2];
static vector < int > g2[MAXN2];
static long long tmp, XX;
static int lvl[MAXN2];
static int mx2, timer2;
void dfs2(int v) {
	used2[v] = timer2;
	lvl[v] %= 60;
	mx2 = max(mx2, lvl[v]);
	val2[v] = (bool)((1ll << lvl[v]*1ll) & XX);
	for(auto &to : g2[v]) {
		if(used2[to] != timer2) {
			lvl[to] = lvl[v] + 1;
			dfs2(to);
		}
	}
}

void Joi(int n, int m, int A[], int B[], long long X, int T) {
  for(int i = 0; i < n; i++){
    val2[i] = -1; used2[i] = 0;
    g2[i].clear();
  }
  for(int i = 0; i < m; ++i) {
		g2[A[i]].push_back(B[i]);
		g2[B[i]].push_back(A[i]);
  }
  XX = X;
  for(int root = 0; root < n; ++root) {
  	timer2++;
  	mx2 = 0;
		dfs2(root);
		if(mx2 == 59) break;
		assert(mx2 < 60);
	}
	for(int i = 0; i < n; ++i) MessageBoard(i, val2[i]);
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
static const int MAXN1 = (int)2e5+228;
static bool used1[MAXN1];
static vector < int > g1[MAXN1];
static int val1[MAXN1], lvl1[MAXN1], par[MAXN1], come[MAXN1];
static long long ret = 0ll;
static int mx1, timer1;
void dfs1(int v) {
	used1[v] = timer1;
	lvl1[v] %= 60;
	mx1 = max(mx1, lvl1[v]);
	for(auto &to : g1[v]) {
		if(used1[to] != timer1) {
			lvl1[to] = lvl1[v]+1;
			come[to] = v;
			dfs1(to);
		}
	}
}
static int D[MAXN1];
queue < int > qq;
long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
	return 0ll;
	for(int i = 0; i < n; ++i) {
		used1[i] = 0;
		val1[i] = -1;
		g1[i].clear();
	}
	val1[P] = V;
	for(int i = 0; i < m; ++i) {
		g1[A[i]].push_back(B[i]);
		g1[B[i]].push_back(A[i]);
	}
	ret = 0ll;
	int root = 0;
	do {
		timer1++;
		mx1 = 0;
		dfs1(root);
		if(mx1 == 59) break;
	} while(1);
	for(int i = 0; i < n; ++i) {
		D[i] = -1;
		par[i] = -1;
		if(lvl1[i] == 59) {
			qq.push(i);
			D[i] = 0;
		}
	}
	while(!qq.empty()) {
		int v = qq.front(); qq.pop();
		for(auto &to : g1[v]) {
			if(D[to] == -1) {
				qq.push(to);
				D[to] = D[v]+1;
				par[to] = v;
			}
		}
	}
	while(lvl1[P] != 59) {
		val1[par[P]] = Move(par[P]);
		P = par[P];
	}
	assert(lvl1[P] == 59);
	while(lvl1[P] > 0) {
		ret |= (1ll << lvl1[P]) * val1[P];
		val1[come[P]] = Move(come[P]);
		P = come[P];
	}
	assert(lvl1[P] == 0);
	ret |= (1ll << lvl1[P]) * val1[P];
  return ret;
}

Compilation message

Joi.cpp:7:18: warning: 'tmp' defined but not used [-Wunused-variable]
 static long long tmp, XX;
                  ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 10224 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 38 ms 13208 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 13208 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 13528 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 13656 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -