# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1164571 | Thanhs | Broken Device (JOI17_broken_device) | C++20 | 0 ms | 320 KiB |
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
#define name "TENBAI"
#define fi first
#define se second
#define endl '\n'
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))
#define sqr(x) ((x) * (x))
mt19937 hdp(69420);
int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}
vector<int> P(150);
bool bl[150];
void Anna(int n, long long x, int k, int p[])
{
iota(P.begin(), P.end(), 0);
shuffle(P.begin(), P.end(), mt19937(69420));
for (int i = 0; i < k; i++)
bl[p[i]] = 1;
int cr = 0, L = (x ? __lg(x) : 0);
for (int i = 0; i < L; i++)
{
while (1)
{
assert(cr < n);
if (cr + 1 < n && !bl[P[cr]] && !bl[P[cr + 1]] && (x >> i & 3) == 3)
{
Set(P[cr], 1), Set(P[cr + 1], 1);
break;
}
if (!bl[P[cr + (x >> i & 1)]])
{
Set(P[cr + (x >> i & 1)], 1);
break;
}
cr += 2;
}
cr += 2;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
#define name "TENBAI"
#define fi first
#define se second
#define endl '\n'
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))
#define sqr(x) ((x) * (x))
mt19937 hdp(69420);
int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}
vector<int> P(150);
bool bl[150];
long long Bruno(int n, int a[])
{
iota(P.begin(), P.end(), 0);
shuffle(P.begin(), P.end(), mt19937(69420));
long long res = 0, cr = 1;
for (int i = 0; i < n; i++)
{
if (a[i] && a[i + 1])
{
res += 3 * cr, cr *= 4;
}
else if (a[i])
cr *= 2;
else
res += cr, cr *= 2;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |