# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
55035 | ksun48 | Broken Device (JOI17_broken_device) | C++14 | 105 ms | 3984 KiB |
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 "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
void done(vector<LL> message, vector<LL> perm){
for(int i = 0; i < message.size(); i++){
Set(i, message[perm[i]]);
}
}
void Anna(int N, long long X, int K, int P[]){
// shared initialization
static mt19937_64 mt1(48);
static mt19937_64 mt2(4848);
static LL B = 60;
LL Y = mt1() & ((1LL << B) - 1);
vector<LL> perm(N);
for(int i = 0; i < N; i++){
perm[i] = i;
}
for(int i = N-1; i >= 0; i--){
int d = mt2() % (i+1);
if(d < 0){
d += (i+1);
}
swap(perm[i], perm[d]);
}
// shared initialization
vector<LL> info(60);
for(LL i = 0; i < 60; i++){
info[i] = ((X ^ Y) >> i) & 1;
}
vector<LL> message(N, 0);
for(int i = 0; i < N; i++){
message[i] = info[i % 60];
}
done(message, perm);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
using namespace std;
LL done(vector<LL> info, LL b){
LL a = 0;
for(LL i = 0; i < 60; i++){
a ^= info[i] << i;
}
return a ^ b;
}
long long Bruno(int N, int A[]){
// shared initialization
static mt19937_64 mt1(48);
static mt19937_64 mt2(4848);
static LL B = 60;
LL Y = mt1() & ((1LL << B) - 1);
vector<LL> perm(N);
for(int i = 0; i < N; i++){
perm[i] = i;
}
for(int i = N-1; i >= 0; i--){
int d = mt2() % (i+1);
if(d < 0){
d += (i+1);
}
swap(perm[i], perm[d]);
}
// shared initialization
vector<LL> message(N);
for(int i = 0; i < N; i++){
message[perm[i]] = A[i];
}
vector<LL> info(60, 0);
for(int i = 0; i < N; i++){
info[i % 60] = max(info[i % 60], message[i]);
}
return done(info, Y);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |