# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982872 | AmirAli_H1 | Broken Device (JOI17_broken_device) | C++17 | 59 ms | 2968 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.
// In the name of Allah
#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ld> cld;
#define all(x) (x).begin(),(x).end()
#define len(x) ((ll) (x).size())
#define F first
#define S second
#define pb push_back
#define sep ' '
#define endl '\n'
#define Mp make_pair
#define kill(x) cout << x << '\n', exit(0)
#define set_dec(x) cout << fixed << setprecision(x);
#define file_io(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout);
static int n, k; ll x;
static const int maxn = 150 + 4;
static const int maxlg = 60;
static const int mod = 1e9 + 7;
static int A[maxn], M[maxn];
void Anna(int nx, ll valx, int kx, int p[]) {
n = nx; k = kx; x = valx;
iota(A, A + n, 0); fill(M, M + n, 0);
for (int i = 0; i < k; i++) M[p[i]] = 1;
ll sd = 23232323;
for (int T = 0; T < 10; T++) {
shuffle(A, A + n, default_random_engine(sd));
sd = (sd * 23) % mod;
}
int j = 0;
for (int i = 1; i < n; i += 2) {
int j1 = A[i - 1], j2 = A[i];
if (j >= maxlg) {
Set(j1, 0); Set(j2, 0);
}
else {
if (x & (1ll << j)) {
if (M[j1]) {
Set(j1, 0); Set(j2, 0);
}
else {
Set(j1, 1); Set(j2, 0);
j++;
}
}
else {
if (M[j2]) {
Set(j1, 0); Set(j2, 0);
}
else {
Set(j1, 0); Set(j2, 1);
j++;
}
}
}
}
if (n % 2 == 1) Set(A[n - 1], 0);
}
// In the name of Allah
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef complex<ld> cld;
#define all(x) (x).begin(),(x).end()
#define len(x) ((ll) (x).size())
#define F first
#define S second
#define pb push_back
#define sep ' '
#define endl '\n'
#define Mp make_pair
#define kill(x) cout << x << '\n', exit(0)
#define set_dec(x) cout << fixed << setprecision(x);
#define file_io(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout);
static int n;
static const int maxn = 150 + 4;
static const int maxlg = 60;
static const int mod = 1e9 + 7;
static int A[maxn], val[maxn];
ll Bruno(int nx, int a[]) {
n = nx; iota(A, A + n, 0);
for (int i = 0; i < n; i++) val[i] = a[i];
ll sd = 23232323;
for (int T = 0; T < 10; T++) {
shuffle(A, A + n, default_random_engine(sd));
sd = (sd * 23) % mod;
}
int j = 0; ll res = 0;
for (int i = 1; i < n; i += 2) {
int j1 = A[i - 1], j2 = A[i];
if (val[j1] != 0) {
res ^= (1ll << j);
j++;
}
else if (val[j2] != 0) {
j++;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |