답안 #946984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946984 2024-03-15T09:08:48 Z pragmatist Amusement Park (JOI17_amusement_park) C++17
18 / 100
18 ms 4564 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);
         	break;
		}
	}
	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 1296 KB Output is correct
3 Correct 2 ms 1308 KB Output is correct
4 Correct 0 ms 1296 KB Output is correct
5 Correct 2 ms 1296 KB Output is correct
6 Correct 0 ms 1304 KB Output is correct
7 Correct 1 ms 1308 KB Output is correct
8 Correct 1 ms 1296 KB Output is correct
9 Correct 1 ms 1308 KB Output is correct
10 Correct 1 ms 1292 KB Output is correct
11 Correct 3 ms 1860 KB Output is correct
12 Correct 1 ms 1308 KB Output is correct
13 Correct 1 ms 1312 KB Output is correct
14 Correct 1 ms 1304 KB Output is correct
15 Correct 1 ms 1312 KB Output is correct
16 Correct 1 ms 1312 KB Output is correct
17 Correct 1 ms 1292 KB Output is correct
18 Correct 1 ms 1304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 4456 KB Output is correct
2 Correct 17 ms 4564 KB Output is correct
3 Correct 16 ms 4444 KB Output is correct
4 Correct 12 ms 3040 KB Output is correct
5 Correct 11 ms 3536 KB Output is correct
6 Correct 9 ms 3284 KB Output is correct
7 Correct 9 ms 3300 KB Output is correct
8 Correct 9 ms 3300 KB Output is correct
9 Correct 9 ms 3548 KB Output is correct
10 Correct 9 ms 3032 KB Output is correct
11 Correct 9 ms 3044 KB Output is correct
12 Correct 9 ms 2760 KB Output is correct
13 Correct 8 ms 2768 KB Output is correct
14 Correct 9 ms 2772 KB Output is correct
15 Correct 9 ms 3028 KB Output is correct
16 Incorrect 9 ms 3032 KB Wrong Answer [7]
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1304 KB Output is correct
2 Correct 0 ms 1308 KB Output is correct
3 Correct 0 ms 1420 KB Output is correct
4 Correct 2 ms 1848 KB Output is correct
5 Correct 2 ms 1840 KB Output is correct
6 Correct 2 ms 1848 KB Output is correct
7 Correct 3 ms 1848 KB Output is correct
8 Correct 2 ms 1848 KB Output is correct
9 Correct 7 ms 4060 KB Output is correct
10 Correct 7 ms 4068 KB Output is correct
11 Correct 7 ms 4064 KB Output is correct
12 Correct 1 ms 1292 KB Output is correct
13 Correct 1 ms 1308 KB Output is correct
14 Correct 0 ms 1308 KB Output is correct
15 Correct 1 ms 1296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 18 ms 4444 KB Partially correct
2 Partially correct 16 ms 4456 KB Partially correct
3 Partially correct 17 ms 4336 KB Partially correct
4 Partially correct 9 ms 3028 KB Partially correct
5 Partially correct 9 ms 3812 KB Partially correct
6 Partially correct 10 ms 3544 KB Partially correct
7 Partially correct 9 ms 3288 KB Partially correct
8 Partially correct 9 ms 3040 KB Partially correct
9 Partially correct 9 ms 3288 KB Partially correct
10 Correct 9 ms 3040 KB Output is correct
11 Incorrect 12 ms 3032 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 4392 KB Output isn't correct
2 Halted 0 ms 0 KB -