This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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) {
edges.push_back({(x & 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) {
if (X[perm[j]] != -1) bit = X[perm[j]]-1;
}
//cout << bit;
f += bit * k;
k *= 2;
}
//cout << endl;
return f;
}
Compilation message (stderr)
Alice.cpp: In function 'std::vector<std::pair<int, int> > Alice()':
Alice.cpp:29:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for (int i=mx+1; i<perm.size(); ++i) {
| ~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |