# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990770 | abczz | Broken Device (JOI17_broken_device) | C++14 | 146 ms | 2960 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 <iostream>
#include <random>
#define ll long long
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
srand(7318371);
ll x = 805215019090496300, L[60][150];
bool B[150], F[150];
for (int i=0; i<N; ++i) B[i] = F[i] = 0;
for (int i=0; i<K; ++i) B[P[i]] = 1;
x ^= X;
for (int i=0; i<60; ++i) {
L[i][0] = rand() & 1;
L[i][1] = L[i][0] ^ 1;
for (int j=2; j<N; ++j) {
L[i][j] = rand() & 1;
}
}
ll p = 0;
for (int i=59; i>=0; --i) {
ll bit = (bool)(x & (1LL<<i));
for (int j=0; j<N; ++j) {
if (L[i][j] == bit && !B[p+j]) {
//cout << i << " " << j << endl;
F[p+j] = 1;
p += j+1;
break;
}
}
}
for (int i=0; i<N; ++i) {
Set(i, F[i]);
}
}
#include "Brunolib.h"
#include <iostream>
#include <vector>
#include <random>
#define ll long long
using namespace std;
long long Bruno( int N, int A[] ){
srand(7318371);
ll x = 805215019090496300, L[60][150];
vector <ll> V;
for (int i=0; i<60; ++i) {
L[i][0] = rand() & 1;
L[i][1] = L[i][0] ^ 1;
for (int j=2; j<N; ++j) {
L[i][j] = rand() & 1;
}
}
ll p = 0;
for (int i=0; i<N; ++i) {
if (A[i]) {
V.push_back(i);
}
}
int j = 0;
for (int i=59; i>=0; --i) {
//cout << V[j]-p << " ";
if (L[i][V[j]-p]) x ^= (1LL<<i);
p = V[j++]+1;
}
//cout << endl;
//cout << x << endl;
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |