# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
993544 |
2024-06-06T02:55:44 Z |
abczz |
Magic Show (APIO24_show) |
C++17 |
|
3 ms |
1592 KB |
#include <vector>
#include "Alice.h"
#include <iostream>
#include <random>
#include <algorithm>
#define ll long long
using namespace std;
std::vector<std::pair<int,int>> Alice(){
mt19937_64 mt(69);
vector <pair<int, int>> edges;
vector <ll> perm;
ll n = 5000;
ll x = setN(5000);
ll mx = 0;
for (int i=3; i<=n; ++i) {
perm.push_back(i);
}
shuffle(perm.begin(), perm.end(), mt);
edges.push_back({1, 2});
for (int i=0; i<60; ++i) {
for (int j=i*83; j<(i+1)*83; ++j) {
ll rnd = mt() % (perm[j]-1);
if (!(x & 1)) edges.push_back({rnd+1, perm[j]});
else edges.push_back({((rnd+1) % (perm[j]-1)) + 1, perm[j]});
mx = max(mx, (ll)j);
}
x /= 2;
}
for (int i=mx+1; i<perm.size(); ++i) {
edges.push_back({1, perm[i]});
}
shuffle(edges.begin(), edges.end(), mt);
return edges;
}
#include <vector>
#include "Bob.h"
#include <iostream>
#include <random>
#include <algorithm>
#define ll long long
using namespace std;
long long Bob(std::vector<std::pair<int,int>> V){
mt19937_64 mt(69);
vector <ll> perm;
ll n = 5000, X[5001], k = 1, f = 0;
for (int i=3; i<=n; ++i) {
X[i] = -1;
perm.push_back(i);
}
shuffle(perm.begin(), perm.end(), mt);
for (auto [a, b] : V) {
X[b] = a;
}
for (int i=0; i<60; ++i) {
ll bit = 0;
for (int j=i*83; j<(i+1)*83; ++j) {
ll rnd = mt() % (perm[j]-1);
if (X[perm[j]] == rnd+1) bit = 0;
else if (X[perm[j]] != -1) bit = 1;
}
//cout << bit;
f += bit * k;
k *= 2;
}
//cout << endl;
return f;
}
Compilation message
Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:31:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for (int i=mx+1; i<perm.size(); ++i) {
| ~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1332 KB |
Correct. |
2 |
Correct |
2 ms |
1332 KB |
Correct. |
3 |
Correct |
3 ms |
1336 KB |
Correct. |
4 |
Correct |
2 ms |
1332 KB |
Correct. |
5 |
Correct |
2 ms |
1156 KB |
Correct. |
6 |
Correct |
2 ms |
1332 KB |
Correct. |
7 |
Correct |
2 ms |
1348 KB |
Correct. |
8 |
Correct |
2 ms |
1344 KB |
Correct. |
9 |
Correct |
2 ms |
1340 KB |
Correct. |
10 |
Correct |
2 ms |
1344 KB |
Correct. |
11 |
Correct |
2 ms |
1332 KB |
Correct. |
12 |
Correct |
2 ms |
1332 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1332 KB |
Correct. |
2 |
Correct |
2 ms |
1332 KB |
Correct. |
3 |
Correct |
3 ms |
1336 KB |
Correct. |
4 |
Correct |
2 ms |
1332 KB |
Correct. |
5 |
Correct |
2 ms |
1156 KB |
Correct. |
6 |
Correct |
2 ms |
1332 KB |
Correct. |
7 |
Correct |
2 ms |
1348 KB |
Correct. |
8 |
Correct |
2 ms |
1344 KB |
Correct. |
9 |
Correct |
2 ms |
1340 KB |
Correct. |
10 |
Correct |
2 ms |
1344 KB |
Correct. |
11 |
Correct |
2 ms |
1332 KB |
Correct. |
12 |
Correct |
2 ms |
1332 KB |
Correct. |
13 |
Correct |
3 ms |
1344 KB |
Correct. |
14 |
Correct |
2 ms |
1344 KB |
Correct. |
15 |
Correct |
2 ms |
1340 KB |
Correct. |
16 |
Correct |
2 ms |
1332 KB |
Correct. |
17 |
Correct |
2 ms |
1344 KB |
Correct. |
18 |
Correct |
2 ms |
1332 KB |
Correct. |
19 |
Correct |
2 ms |
1332 KB |
Correct. |
20 |
Correct |
2 ms |
1332 KB |
Correct. |
21 |
Correct |
2 ms |
1340 KB |
Correct. |
22 |
Correct |
2 ms |
1332 KB |
Correct. |
23 |
Correct |
2 ms |
1332 KB |
Correct. |
24 |
Correct |
2 ms |
1344 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1332 KB |
Correct. |
2 |
Correct |
2 ms |
1332 KB |
Correct. |
3 |
Correct |
3 ms |
1336 KB |
Correct. |
4 |
Correct |
2 ms |
1332 KB |
Correct. |
5 |
Correct |
2 ms |
1156 KB |
Correct. |
6 |
Correct |
2 ms |
1332 KB |
Correct. |
7 |
Correct |
2 ms |
1348 KB |
Correct. |
8 |
Correct |
2 ms |
1344 KB |
Correct. |
9 |
Correct |
2 ms |
1340 KB |
Correct. |
10 |
Correct |
2 ms |
1344 KB |
Correct. |
11 |
Correct |
2 ms |
1332 KB |
Correct. |
12 |
Correct |
2 ms |
1332 KB |
Correct. |
13 |
Correct |
3 ms |
1344 KB |
Correct. |
14 |
Correct |
2 ms |
1344 KB |
Correct. |
15 |
Correct |
2 ms |
1340 KB |
Correct. |
16 |
Correct |
2 ms |
1332 KB |
Correct. |
17 |
Correct |
2 ms |
1344 KB |
Correct. |
18 |
Correct |
2 ms |
1332 KB |
Correct. |
19 |
Correct |
2 ms |
1332 KB |
Correct. |
20 |
Correct |
2 ms |
1332 KB |
Correct. |
21 |
Correct |
2 ms |
1340 KB |
Correct. |
22 |
Correct |
2 ms |
1332 KB |
Correct. |
23 |
Correct |
2 ms |
1332 KB |
Correct. |
24 |
Correct |
2 ms |
1344 KB |
Correct. |
25 |
Correct |
2 ms |
1332 KB |
Correct. |
26 |
Correct |
2 ms |
1332 KB |
Correct. |
27 |
Correct |
2 ms |
1332 KB |
Correct. |
28 |
Correct |
2 ms |
1344 KB |
Correct. |
29 |
Correct |
2 ms |
1332 KB |
Correct. |
30 |
Correct |
2 ms |
1332 KB |
Correct. |
31 |
Correct |
2 ms |
1336 KB |
Correct. |
32 |
Correct |
2 ms |
1332 KB |
Correct. |
33 |
Correct |
2 ms |
1336 KB |
Correct. |
34 |
Correct |
1 ms |
1332 KB |
Correct. |
35 |
Correct |
1 ms |
1344 KB |
Correct. |
36 |
Correct |
3 ms |
1592 KB |
Correct. |
37 |
Correct |
1 ms |
1332 KB |
Correct. |
38 |
Correct |
2 ms |
1584 KB |
Correct. |
39 |
Correct |
2 ms |
1336 KB |
Correct. |
40 |
Correct |
3 ms |
1332 KB |
Correct. |
41 |
Correct |
1 ms |
1332 KB |
Correct. |
42 |
Correct |
2 ms |
1332 KB |
Correct. |
43 |
Correct |
1 ms |
1332 KB |
Correct. |
44 |
Correct |
2 ms |
1332 KB |
Correct. |