# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
784046 | AdamGS | Broken Device (JOI17_broken_device) | C++17 | 38 ms | 2464 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;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void Anna(int n, ll x, int k, int P[]) {
vector<int>V(n), czy(n), odw(n);
srand(213769);
rep(i, n) {
V[i]=i;
swap(V[i], V[rand()%(i+1)]);
}
rep(i, k) czy[P[i]]=1;
ll akt=0;
rep(i, V.size()-1) if(!czy[V[i]] && !czy[V[i+1]]) {
Set(V[i], 1);
odw[V[i]]=1;
++i;
if(akt<60 && x&(1ll<<akt)) Set(V[i], 1); else Set(V[i], 0);
++akt;
odw[V[i]]=1;
}
rep(i, n) if(!odw[i]) Set(i, 0);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
ll Bruno(int n, int A[]) {
vector<int>V(n);
srand(213769);
rep(i, n) {
V[i]=i;
swap(V[i], V[rand()%(i+1)]);
}
ll akt=0, ans=0;
rep(i, V.size()-1) if(A[V[i]]) {
++i;
if(A[V[i]]) ans+=1ll<<akt;
++akt;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |