답안 #41802

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41802 2018-02-21T09:02:14 Z RockyB Amusement Park (JOI17_amusement_park) C++14
8 / 100
60 ms 28464 KB
/// In The Name Of God

#include <bits/stdc++.h>
#include "Joi.h"

#define ioi exit(0);

using namespace std;

class Solve1 {
	static const int N = 2e5 + 7;

	int n, m, T;
	long long x;
	int *a, *b;


	int cnt;
	vector <int> g[N];
	bool was[N];

	public:
		Solve1() {}
		Solve1(int n, int m, int a[], int b[], long long x, int T) :
		n(n), m(m), a(a), b(b), x(x), T(T) {}

		void dfs(int v = 0) {
			was[v] = 1;
			if (cnt <= 59) {
				int type = (x & (1LL << cnt)) > 0;
				MessageBoard(v, type);
			}
			else {
				MessageBoard(v, 0);
			}
			++cnt;
			for (auto to : g[v]) {
				if (!was[to]) {
					dfs(to);
				}
			}
		}
		void solve() {
			for (int i = 0; i < m; i++) {
				g[a[i]].push_back(b[i]);
				g[b[i]].push_back(a[i]);
			}
			dfs();
		}
} S1;


void Joi(int n, int m, int a[], int b[], long long x, int T) {
	S1 = Solve1(n, m, a, b, x, T);
	S1.solve();
}




/*int32_t main() {

}
*/
/*int32_t main() {
	S1.solve();
	ioi
}*/


/*int32_t main() {

	return 0;
}*/

/*#ifdef IOI2018
int main() {
	freopen ("in.txt", "r", stdin);
	
	ioi
}
#endif
*/
/// In The Name Of God
 
#include "Ioi.h"
#include <bits/stdc++.h>
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
 
#define Kazakhstan ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
 
#define nl '\n'
#define ioi exit(0);
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
static const int N = (int)5e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;
 
using namespace std;
 
vector <int> g[N];
 
ll res;
 
int last;
bool found;
bool was[N];
void dfs(int v) {
	was[v] = 1;
	if (found || !v) {
		found = 1;
		return;
	}
	for (auto to : g[v]) {
		if (!was[to] && !found) {
			last = Move(to);
			dfs(to);
			if (!found) last = Move(v);
		}
	}
}
 
int cnt;
void dfs1(int v) {
	was[v] = 1;
	if (cnt <= 59) {
		res += (1LL << cnt) * last;
	}
	cnt++;
	for (auto to : g[v]) {
		if (!was[to]) {
			last = Move(to);
			dfs1(to);
			Move(v);
		}
	}
}
ll Ioi(int n, int m, int a[], int b[], int p, int v, int t) {
	for (int i = 0; i < m; i++) {
		g[a[i]].pb(b[i]);
		g[b[i]].pb(a[i]);
	}
	last = v;
	dfs(p);
	memset(was, 0, sizeof(was));
	dfs1(0);
	return res;
}	
 
/*#ifdef IOI2018
int main() {
	freopen ("in.txt", "r", stdin);
	
	ioi
}
#endif*/

Compilation message

Joi.cpp: In constructor 'Solve1::Solve1(int, int, int*, int*, long long int, int)':
Joi.cpp:15:11: warning: 'Solve1::b' will be initialized after [-Wreorder]
  int *a, *b;
           ^
Joi.cpp:14:12: warning:   'long long int Solve1::x' [-Wreorder]
  long long x;
            ^
Joi.cpp:24:3: warning:   when initialized here [-Wreorder]
   Solve1(int n, int m, int a[], int b[], long long x, int T) :
   ^
Joi.cpp:14:12: warning: 'Solve1::x' will be initialized after [-Wreorder]
  long long x;
            ^
Joi.cpp:13:12: warning:   'int Solve1::T' [-Wreorder]
  int n, m, T;
            ^
Joi.cpp:24:3: warning:   when initialized here [-Wreorder]
   Solve1(int n, int m, int a[], int b[], long long x, int T) :
   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 22368 KB Output is correct
2 Correct 20 ms 25336 KB Output is correct
3 Correct 22 ms 25632 KB Output is correct
4 Correct 22 ms 25704 KB Output is correct
5 Correct 23 ms 25776 KB Output is correct
6 Correct 20 ms 25776 KB Output is correct
7 Correct 23 ms 25776 KB Output is correct
8 Correct 24 ms 25776 KB Output is correct
9 Correct 22 ms 25776 KB Output is correct
10 Correct 22 ms 25880 KB Output is correct
11 Correct 26 ms 25984 KB Output is correct
12 Correct 22 ms 25984 KB Output is correct
13 Correct 22 ms 25984 KB Output is correct
14 Correct 22 ms 25984 KB Output is correct
15 Correct 22 ms 26004 KB Output is correct
16 Correct 23 ms 26024 KB Output is correct
17 Correct 25 ms 26024 KB Output is correct
18 Correct 23 ms 26024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 27244 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 28464 KB Output is correct
2 Correct 23 ms 28464 KB Output is correct
3 Incorrect 23 ms 28464 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 28464 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 28464 KB Wrong Answer [8]
2 Halted 0 ms 0 KB -