Submission #946977

# Submission time Handle Problem Language Result Execution time Memory
946977 2024-03-15T09:03:17 Z pragmatist Amusement Park (JOI17_amusement_park) C++17
10 / 100
17 ms 4904 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);
		}
	}
}
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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1308 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 2 ms 1300 KB Output is correct
4 Correct 1 ms 1304 KB Output is correct
5 Correct 1 ms 1308 KB Output is correct
6 Correct 1 ms 1312 KB Output is correct
7 Correct 1 ms 1308 KB Output is correct
8 Correct 1 ms 1316 KB Output is correct
9 Correct 2 ms 1308 KB Output is correct
10 Correct 1 ms 1296 KB Output is correct
11 Incorrect 3 ms 1888 KB Wrong Answer [7]
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 4852 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1312 KB Output is correct
2 Correct 1 ms 1312 KB Output is correct
3 Correct 1 ms 1300 KB Output is correct
4 Correct 2 ms 2116 KB Output is correct
5 Correct 2 ms 1864 KB Output is correct
6 Correct 2 ms 1860 KB Output is correct
7 Correct 2 ms 1856 KB Output is correct
8 Correct 2 ms 1856 KB Output is correct
9 Correct 8 ms 4404 KB Output is correct
10 Correct 9 ms 4416 KB Output is correct
11 Correct 8 ms 4420 KB Output is correct
12 Correct 0 ms 1312 KB Output is correct
13 Correct 1 ms 1312 KB Output is correct
14 Correct 1 ms 1308 KB Output is correct
15 Correct 0 ms 1312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 17 ms 4740 KB Partially correct
2 Incorrect 16 ms 4904 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 4896 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -