답안 #394512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394512 2021-04-26T18:13:35 Z jsannemo Amusement Park (JOI17_amusement_park) C++14
10 / 100
48 ms 6020 KB
#include "Joi.h"

#include <vector>
#include <map>

using namespace std;

static vector<vector<int>> adj;

static vector<int> ord;
static map<int, int> bit;
static vector<bool> seen;

static void dfs(int at) {
	seen[at] = true;
	ord.push_back(at);
	for (int it : adj[at]) {
		if (seen[it]) continue;
		dfs(it);
		ord.push_back(at);
	}
	int b = (int)bit.size();
	bit[at] = b % 60;
}

void Joi(int N, int M, int A[], int B[], long long X, int T) {
	adj.resize(N);
	seen.resize(N);
	for (int i = 0; i < M; i ++) {
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(0);
	ord.pop_back();

  for(int i = 0; i < N; i++){
    MessageBoard(i, (X >> bit[i]) & 1);
  }
}
#include "Ioi.h"

#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

using namespace std;

static vector<vector<int>> adj;

static vector<int> ord;
static map<int, int> bit;
static vector<bool> seen;
static map<int, int> bits;

static void dfs(int at) {
	seen[at] = true;
	ord.push_back(at);
	for (int it : adj[at]) {
		if (seen[it]) continue;
		dfs(it);
		ord.push_back(at);
	}
	int b = (int)bit.size();
	bit[at] = b % 60;
}

static void dfs2(int at) {
	for (int it : adj[at]) {
		if (bits.count(bit[it])) continue;
		bits[bit[it]] = Move(it);
		dfs2(it);
		Move(at);
	}
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	adj.resize(N);
	seen.resize(N);
	for (int i = 0; i < M; i ++) {
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(0);
	ord.pop_back();

	bits[bit[P]] = V;
	dfs2(P);

	//int at = find(ord.begin(), ord.end(), P) - ord.begin();
	//while ((int)bits.size() != 60) {
		//at = (at + 1) % ord.size();
		//cerr << "go to " << ord[at] << " get bit " << bit[ord[at]] << endl;
		//bits[bit[ord[at]]] = Move(ord[at]);
	//}
	long long X = 0;
	for (int i = 0; i < 60; ++i) {
		X |= (long long)bits[i] << i;
	}
	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 492 KB Output is correct
2 Incorrect 2 ms 620 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 5872 KB Output is correct
2 Correct 32 ms 5892 KB Output is correct
3 Correct 32 ms 5860 KB Output is correct
4 Correct 22 ms 3816 KB Output is correct
5 Correct 22 ms 4600 KB Output is correct
6 Correct 22 ms 4360 KB Output is correct
7 Incorrect 22 ms 4480 KB Wrong Answer [7]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 704 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 2 ms 624 KB Output is correct
4 Correct 3 ms 1308 KB Output is correct
5 Correct 4 ms 1304 KB Output is correct
6 Correct 4 ms 1392 KB Output is correct
7 Correct 4 ms 1300 KB Output is correct
8 Correct 4 ms 1300 KB Output is correct
9 Correct 18 ms 5500 KB Output is correct
10 Correct 18 ms 5660 KB Output is correct
11 Correct 20 ms 5652 KB Output is correct
12 Correct 1 ms 704 KB Output is correct
13 Correct 1 ms 500 KB Output is correct
14 Correct 2 ms 620 KB Output is correct
15 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 6020 KB Output is correct
2 Correct 39 ms 5796 KB Output is correct
3 Correct 32 ms 5896 KB Output is correct
4 Correct 22 ms 3880 KB Output is correct
5 Correct 20 ms 5160 KB Output is correct
6 Incorrect 20 ms 4628 KB Wrong Answer [7]
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 5824 KB Output is correct
2 Correct 32 ms 5796 KB Output is correct
3 Correct 48 ms 5848 KB Output is correct
4 Incorrect 26 ms 3828 KB Wrong Answer [7]
5 Halted 0 ms 0 KB -