답안 #946983

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946983 2024-03-15T09:08:04 Z pragmatist Amusement Park (JOI17_amusement_park) C++17
10 / 100
17 ms 4448 KB
#include "Joi.h"
#include<bits/stdc++.h>

using namespace std;

bool used1[100005];
vector<int> g1[10005];
int timer1, tin1[10005], tout1[10005];

void dfs1(int v, int pr) {
	used1[v] = 1;
	tin1[v] = ++timer1;
	for(auto to : g1[v]) {
		if(to == pr) {
			continue;
		}
		if(!used1[to]) {
			dfs1(to, v);
		}
	}
	tout1[v] = timer1;
}

void Joi(int _N, int _M, int _A[], int _B[], long long _X, int _T) {
  	int n = _N;
  	int m = _M;
  	for(int i = 0; i < m; ++i) {
  		int u = _A[i];
  		int v = _B[i];
  		g1[u].push_back(v);
  		g1[v].push_back(u);
	}
	long long x = _X;
  	dfs1(0, -1);
	for(int i = 0; i < n; ++i) {
		int j = (tin1[i]%60);
		MessageBoard(i, (x >> j & 1));
	}	
}
#include "Ioi.h"
#include<bits/stdc++.h>

using namespace std;

int n, m, start;
int a[10005];

bool used2[100005];
bool used3[70];
vector<int> g2[10005];
int timer2, tin2[10005], tout2[10005];

void dfs2(int v, int pr) {
	used2[v] = 1;
	tin2[v] = ++timer2;
	for(auto to : g2[v]) {
		if(to == pr) {
			continue;
		}
		if(!used2[to]) {
			dfs2(to, v);
		}
	}
	tout2[v] = timer2;
}

int last = -1;

void dfs3(int v, int pr) {
	last = v;
	used2[tin2[v]%60] = 1;
	int cnt = 0;
	for(auto to : g2[v]) {
		if(!used2[tin2[to]%60] && tin2[to]<tin2[v]) {
			a[tin2[to]%60] = Move(to);
			cnt++;
			dfs3(to, v);
		}
	}
	assert(cnt <= 1);
}
bool used4[70];

void dfs4(int v, int pr) {
	used4[tin2[v]%60] = 1;
	for(auto to : g2[v]) {
		if(!used4[tin2[to]%60]) {
			a[tin2[to]%60] = Move(to);
			dfs4(to, v);
			Move(v);
		}
	}
}

long long Ioi(int _N, int _M, int _A[], int _B[], int _P, int _V, int _T) {
	n = _N;
	m = _M;
	start = _P;
	for(int i = 0; i < m; ++i) {
		int u = _A[i];
		int v = _B[i];
		g2[u].push_back(v);
		g2[v].push_back(u);
	}
	dfs2(0, -1);
	a[tin2[start]%60] = _V;
	memset(used2, 0, sizeof(used2));
	used2[tin2[start]%60] = 1;
	dfs3(start, -1);
	
	dfs4(last, -1);
	long long ans = 0;
	for(int i = 0; i < 60; ++i) {
		if(a[i]) {
			ans |= (1ll << i);
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1308 KB Output is correct
2 Correct 1 ms 1304 KB Output is correct
3 Correct 1 ms 1308 KB Output is correct
4 Correct 1 ms 1304 KB Output is correct
5 Correct 0 ms 1308 KB Output is correct
6 Correct 0 ms 1304 KB Output is correct
7 Correct 2 ms 1484 KB Output is correct
8 Correct 1 ms 1208 KB Output is correct
9 Correct 0 ms 1312 KB Output is correct
10 Correct 0 ms 1296 KB Output is correct
11 Incorrect 3 ms 1864 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 4396 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1308 KB Output is correct
2 Correct 2 ms 1296 KB Output is correct
3 Correct 2 ms 1308 KB Output is correct
4 Correct 2 ms 1844 KB Output is correct
5 Correct 2 ms 1848 KB Output is correct
6 Correct 2 ms 1844 KB Output is correct
7 Correct 2 ms 1848 KB Output is correct
8 Correct 2 ms 1852 KB Output is correct
9 Correct 7 ms 4064 KB Output is correct
10 Correct 8 ms 4064 KB Output is correct
11 Correct 9 ms 4056 KB Output is correct
12 Correct 0 ms 1292 KB Output is correct
13 Correct 0 ms 1320 KB Output is correct
14 Correct 0 ms 1296 KB Output is correct
15 Correct 1 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 16 ms 4448 KB Partially correct
2 Incorrect 16 ms 4444 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 4444 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -