답안 #946935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946935 2024-03-15T07:49:28 Z pragmatist Amusement Park (JOI17_amusement_park) C++17
10 / 100
20 ms 4452 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;
}

void dfs3(int v, int pr) {
	used2[tin2[v]%60] = 1;
	for(auto to : g2[v]) {
		if(!used2[tin2[to]%60]) {
			a[tin2[to]%60] = Move(to);
			dfs3(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));
	
	dfs3(start, -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 1304 KB Output is correct
2 Correct 1 ms 1288 KB Output is correct
3 Incorrect 1 ms 1304 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4452 KB Output is correct
2 Correct 16 ms 4328 KB Output is correct
3 Correct 16 ms 4320 KB Output is correct
4 Correct 9 ms 3236 KB Output is correct
5 Correct 9 ms 3544 KB Output is correct
6 Correct 9 ms 3300 KB Output is correct
7 Correct 10 ms 3284 KB Output is correct
8 Correct 9 ms 3552 KB Output is correct
9 Correct 10 ms 3544 KB Output is correct
10 Correct 8 ms 3032 KB Output is correct
11 Correct 9 ms 3036 KB Output is correct
12 Correct 9 ms 2764 KB Output is correct
13 Correct 9 ms 2760 KB Output is correct
14 Correct 9 ms 2768 KB Output is correct
15 Correct 9 ms 3036 KB Output is correct
16 Incorrect 9 ms 3040 KB Wrong Answer [7]
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1308 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 1848 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 1840 KB Output is correct
9 Correct 7 ms 4064 KB Output is correct
10 Correct 7 ms 3936 KB Output is correct
11 Correct 8 ms 4056 KB Output is correct
12 Correct 0 ms 1308 KB Output is correct
13 Correct 1 ms 1308 KB Output is correct
14 Correct 1 ms 1296 KB Output is correct
15 Correct 2 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 4444 KB Output is correct
2 Correct 20 ms 4356 KB Output is correct
3 Correct 17 ms 4452 KB Output is correct
4 Correct 9 ms 3044 KB Output is correct
5 Correct 10 ms 3808 KB Output is correct
6 Correct 9 ms 3544 KB Output is correct
7 Incorrect 9 ms 3548 KB Wrong Answer [7]
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 4448 KB Output is correct
2 Correct 16 ms 4448 KB Output is correct
3 Correct 19 ms 4448 KB Output is correct
4 Correct 9 ms 3040 KB Output is correct
5 Correct 10 ms 4056 KB Output is correct
6 Correct 9 ms 3296 KB Output is correct
7 Correct 9 ms 3296 KB Output is correct
8 Correct 10 ms 3752 KB Output is correct
9 Correct 9 ms 3288 KB Output is correct
10 Correct 9 ms 3032 KB Output is correct
11 Correct 9 ms 3032 KB Output is correct
12 Correct 9 ms 2764 KB Output is correct
13 Incorrect 9 ms 2764 KB Wrong Answer [7]
14 Halted 0 ms 0 KB -