# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
241542 | osaaateiasavtnl | Broken Device (JOI17_broken_device) | C++14 | 66 ms | 3312 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;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
void Anna( int N, long long X, int K, int P[] ){
mt19937 rnd(2007);
vector <int> c(N);
for (int i = 0; i < N; ++i)
c[i] = rnd()&1;
vector <bool> used(N);
for (int i = 0; i < K; ++i)
used[P[i]] = 1;
vector <int> can;
for (int i = 0; i < N; ++i)
if (!used[i])
can.app(i);
int ptr = 0;
vector <bool> ans(N);
for (int bit = 0; bit < 60; ++bit) {
int w = (X >> bit) & 1;
while (ptr < can.size() && c[can[ptr]] != w) {
++ptr;
}
if (ptr == can.size()) {
for (int i = 0; i < N; ++i)
Set(i, 0);
return;
}
ans[can[ptr]] = 1;
++ptr;
}
for (int i = 0; i < N; ++i) {
Set(i, ans[i]);
}
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
long long Bruno( int N, int A[] ){
mt19937 rnd(2007);
vector <int> c(N);
for (int i = 0; i < N; ++i)
c[i] = rnd()&1;
vector <int> pos;
for (int i = 0; i < N; ++i)
if (A[i])
pos.app(i);
long long ans = 0;
for (int i = 0; i < pos.size(); ++i) {
if (c[pos[i]]&1) {
ans += 1ll << i;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |