Submission #1048475

# Submission time Handle Problem Language Result Execution time Memory
1048475 2024-08-08T07:49:59 Z Tob Magic Show (APIO24_show) C++17
100 / 100
2 ms 1088 KB
#include <bits/stdc++.h>
#include "Alice.h"

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

const int B = 80, bit = 60, seed = 12345, C = 20;

vector <pii> Alice() {
	int w = B*bit;
	ll x = setN(w+C);
	vector <pii> res;
	
	mt19937 rng(seed);
	
	vector <int> p;
	for (int i = 0; i < w; i++) p.pb(i/B);
	shuffle(all(p), rng);
	
	for (int i = 1; i < C; i++) res.pb({w+i, w+i+1});
	
	mt19937 rng2(x);
	
	auto val = [&](int x) {
		uniform_int_distribution <int> rnd(0, x-1);
		return rnd(rng2);
	};
	
	for (int i = 0; i < w; i++) {
		if (x & (1LL << p[i])) res.pb({i+1, i+val(C/2-1)+3});
		else res.pb({i+1, i+C/2+val(C/2)+2});
	}
	return res;
}
#include <bits/stdc++.h>
#include "Bob.h"

#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

const int B = 80, bit = 60, seed = 12345, C = 20;

ll Bob(vector <pii> v) {
	int w = B*bit;
	mt19937 rng(seed);
	
	vector <int> p;
	for (int i = 0; i < w; i++) p.pb(i/B);
	shuffle(all(p), rng);
	
	ll res = 0;
	for (auto x : v) {
		if (x.S - x.F <= C/2 && x.F-1 < w) res |= (1LL << p[x.F-1]);
	}
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1076 KB Correct.
2 Correct 1 ms 1076 KB Correct.
3 Correct 1 ms 1068 KB Correct.
4 Correct 2 ms 1076 KB Correct.
5 Correct 2 ms 1076 KB Correct.
6 Correct 2 ms 1072 KB Correct.
7 Correct 1 ms 1076 KB Correct.
8 Correct 1 ms 1076 KB Correct.
9 Correct 1 ms 1084 KB Correct.
10 Correct 1 ms 1072 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 1 ms 1076 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1076 KB Correct.
2 Correct 1 ms 1076 KB Correct.
3 Correct 1 ms 1068 KB Correct.
4 Correct 2 ms 1076 KB Correct.
5 Correct 2 ms 1076 KB Correct.
6 Correct 2 ms 1072 KB Correct.
7 Correct 1 ms 1076 KB Correct.
8 Correct 1 ms 1076 KB Correct.
9 Correct 1 ms 1084 KB Correct.
10 Correct 1 ms 1072 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 1 ms 1076 KB Correct.
13 Correct 1 ms 1076 KB Correct.
14 Correct 1 ms 1076 KB Correct.
15 Correct 1 ms 1076 KB Correct.
16 Correct 1 ms 1084 KB Correct.
17 Correct 2 ms 1072 KB Correct.
18 Correct 2 ms 964 KB Correct.
19 Correct 2 ms 1076 KB Correct.
20 Correct 1 ms 1072 KB Correct.
21 Correct 2 ms 1084 KB Correct.
22 Correct 1 ms 1076 KB Correct.
23 Correct 1 ms 1076 KB Correct.
24 Correct 1 ms 1080 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1076 KB Correct.
2 Correct 1 ms 1076 KB Correct.
3 Correct 1 ms 1068 KB Correct.
4 Correct 2 ms 1076 KB Correct.
5 Correct 2 ms 1076 KB Correct.
6 Correct 2 ms 1072 KB Correct.
7 Correct 1 ms 1076 KB Correct.
8 Correct 1 ms 1076 KB Correct.
9 Correct 1 ms 1084 KB Correct.
10 Correct 1 ms 1072 KB Correct.
11 Correct 2 ms 1072 KB Correct.
12 Correct 1 ms 1076 KB Correct.
13 Correct 1 ms 1076 KB Correct.
14 Correct 1 ms 1076 KB Correct.
15 Correct 1 ms 1076 KB Correct.
16 Correct 1 ms 1084 KB Correct.
17 Correct 2 ms 1072 KB Correct.
18 Correct 2 ms 964 KB Correct.
19 Correct 2 ms 1076 KB Correct.
20 Correct 1 ms 1072 KB Correct.
21 Correct 2 ms 1084 KB Correct.
22 Correct 1 ms 1076 KB Correct.
23 Correct 1 ms 1076 KB Correct.
24 Correct 1 ms 1080 KB Correct.
25 Correct 2 ms 1076 KB Correct.
26 Correct 2 ms 1076 KB Correct.
27 Correct 1 ms 1076 KB Correct.
28 Correct 1 ms 1076 KB Correct.
29 Correct 2 ms 1076 KB Correct.
30 Correct 2 ms 1080 KB Correct.
31 Correct 1 ms 1076 KB Correct.
32 Correct 1 ms 1072 KB Correct.
33 Correct 1 ms 1080 KB Correct.
34 Correct 1 ms 1076 KB Correct.
35 Correct 1 ms 1080 KB Correct.
36 Correct 1 ms 1076 KB Correct.
37 Correct 2 ms 1080 KB Correct.
38 Correct 1 ms 1072 KB Correct.
39 Correct 1 ms 1088 KB Correct.
40 Correct 2 ms 1080 KB Correct.
41 Correct 1 ms 1088 KB Correct.
42 Correct 1 ms 1076 KB Correct.
43 Correct 1 ms 1076 KB Correct.
44 Correct 1 ms 1088 KB Correct.