Submission #41732

# Submission time Handle Problem Language Result Execution time Memory
41732 2018-02-21T05:39:24 Z cmaster Amusement Park (JOI17_amusement_park) C++14
0 / 100
39 ms 13224 KB
#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;
const int MAXN2 = (int)2e5+228;
int val2[MAXN2], used2[MAXN2];
vector < int > g2[MAXN2];

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]);
  }
  int cur = 0;
  for(int i = 0; i < 60; ++i) {
  	bool bit = ((1ll << i*1ll) & X);
		MessageBoard(cur, bit);
		val2[cur] = bit;
		used2[cur] = 1;
		for(auto &to : g2[cur]) {
			if(!used2[to]) {
				cur = to;
				break;
			}
		}
  }
  for(int i = 0; i < n; ++i) if(val2[i] == -1) {
  	MessageBoard(i, 0);
  	val2[i] = 0;
  }
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN1 = (int)2e5+228;
bool used1[MAXN1];
vector < int > g1[MAXN1];
int val1[MAXN1];

void dfs(int v) {
	used1[v] = 1;
	for(auto &to : g1[v]) {
		if(!used1[to]) {
			val1[to] = Move(to);
			dfs(to);
			Move(v);
		}
	}
}

long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
	for(int i = 0; i < n; ++i) {
		used1[i] = 0;
		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]);
	}
	dfs(P);
	long long ret = 0;
	for(int i = 0; i < n; ++i) used1[i] = 0;
	int cur = 0;
	for(int len = 0; len < 60; ++len) {
		ret ^= (1ll << len*1ll) * val1[cur];
		used1[cur] = 1;
		for(auto &to : g1[cur]) {
			if(!used1[to]) {
				cur = to; break;
			}
		}
	}
  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 10224 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 13020 KB Output is correct
2 Incorrect 19 ms 13224 KB Wrong Answer [2]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 13224 KB Output is correct
2 Correct 10 ms 13224 KB Output is correct
3 Correct 10 ms 13224 KB Output is correct
4 Incorrect 12 ms 13224 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 13224 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 13224 KB Wrong Answer [2]
2 Halted 0 ms 0 KB -