Submission #394517

# Submission time Handle Problem Language Result Execution time Memory
394517 2021-04-26T18:22:50 Z jsannemo Amusement Park (JOI17_amusement_park) C++14
10 / 100
38 ms 5724 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;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 488 KB Output is correct
2 Incorrect 2 ms 616 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 5496 KB Output is correct
2 Correct 33 ms 5724 KB Output is correct
3 Correct 32 ms 5424 KB Output is correct
4 Correct 20 ms 3644 KB Output is correct
5 Correct 22 ms 4376 KB Output is correct
6 Correct 22 ms 4180 KB Output is correct
7 Incorrect 27 ms 4120 KB Wrong Answer [7]
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 616 KB Output is correct
2 Correct 2 ms 616 KB Output is correct
3 Correct 2 ms 628 KB Output is correct
4 Correct 4 ms 1280 KB Output is correct
5 Correct 4 ms 1284 KB Output is correct
6 Correct 4 ms 1288 KB Output is correct
7 Correct 4 ms 1380 KB Output is correct
8 Correct 4 ms 1288 KB Output is correct
9 Correct 19 ms 5328 KB Output is correct
10 Correct 17 ms 5456 KB Output is correct
11 Correct 17 ms 5448 KB Output is correct
12 Correct 2 ms 496 KB Output is correct
13 Correct 0 ms 616 KB Output is correct
14 Correct 2 ms 496 KB Output is correct
15 Correct 0 ms 488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 5312 KB Output is correct
2 Correct 32 ms 5424 KB Output is correct
3 Correct 32 ms 5488 KB Output is correct
4 Correct 22 ms 3704 KB Output is correct
5 Correct 23 ms 4840 KB Output is correct
6 Incorrect 20 ms 4412 KB Wrong Answer [7]
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 5440 KB Output is correct
2 Correct 33 ms 5428 KB Output is correct
3 Correct 33 ms 5376 KB Output is correct
4 Incorrect 20 ms 3644 KB Wrong Answer [7]
5 Halted 0 ms 0 KB -