답안 #946980

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946980 2024-03-15T09:04:31 Z pragmatist Amusement Park (JOI17_amusement_park) C++17
18 / 100
19 ms 5136 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;
	for(auto to : g2[v]) {
		if(!used2[tin2[to]%60] && tin2[to]<tin2[v]) {
			a[tin2[to]%60] = Move(to);
			dfs3(to, v);
			break;
		}
	}
}
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 0 ms 1296 KB Output is correct
2 Correct 1 ms 1308 KB Output is correct
3 Correct 0 ms 1308 KB Output is correct
4 Correct 1 ms 1292 KB Output is correct
5 Correct 0 ms 1308 KB Output is correct
6 Correct 1 ms 1296 KB Output is correct
7 Correct 1 ms 1304 KB Output is correct
8 Correct 1 ms 1312 KB Output is correct
9 Correct 2 ms 1304 KB Output is correct
10 Correct 1 ms 1308 KB Output is correct
11 Correct 3 ms 1860 KB Output is correct
12 Correct 1 ms 1312 KB Output is correct
13 Correct 1 ms 1820 KB Output is correct
14 Correct 1 ms 1316 KB Output is correct
15 Correct 1 ms 1304 KB Output is correct
16 Correct 2 ms 1300 KB Output is correct
17 Correct 1 ms 1316 KB Output is correct
18 Correct 1 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4444 KB Output is correct
2 Correct 16 ms 4732 KB Output is correct
3 Correct 19 ms 5136 KB Output is correct
4 Correct 10 ms 2996 KB Output is correct
5 Correct 9 ms 3644 KB Output is correct
6 Correct 9 ms 3388 KB Output is correct
7 Correct 9 ms 3376 KB Output is correct
8 Correct 9 ms 3392 KB Output is correct
9 Correct 10 ms 3636 KB Output is correct
10 Correct 9 ms 3384 KB Output is correct
11 Correct 9 ms 3384 KB Output is correct
12 Correct 9 ms 2856 KB Output is correct
13 Correct 9 ms 2852 KB Output is correct
14 Correct 9 ms 2972 KB Output is correct
15 Correct 10 ms 3136 KB Output is correct
16 Incorrect 9 ms 3132 KB Wrong Answer [7]
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1296 KB Output is correct
2 Correct 0 ms 1296 KB Output is correct
3 Correct 1 ms 1296 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 2 ms 1844 KB Output is correct
8 Correct 2 ms 1840 KB Output is correct
9 Correct 8 ms 4068 KB Output is correct
10 Correct 7 ms 4056 KB Output is correct
11 Correct 8 ms 4056 KB Output is correct
12 Correct 0 ms 1308 KB Output is correct
13 Correct 2 ms 1296 KB Output is correct
14 Correct 1 ms 1292 KB Output is correct
15 Correct 1 ms 1296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 16 ms 4448 KB Partially correct
2 Partially correct 16 ms 4456 KB Partially correct
3 Partially correct 16 ms 4776 KB Partially correct
4 Partially correct 9 ms 3136 KB Partially correct
5 Partially correct 9 ms 3908 KB Partially correct
6 Partially correct 9 ms 4144 KB Partially correct
7 Partially correct 9 ms 3644 KB Partially correct
8 Partially correct 9 ms 3392 KB Partially correct
9 Partially correct 10 ms 3384 KB Partially correct
10 Correct 9 ms 3396 KB Output is correct
11 Incorrect 9 ms 3128 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 4476 KB Output isn't correct
2 Halted 0 ms 0 KB -