# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990390 | amine_aroua | Broken Device (JOI17_broken_device) | C++17 | 31 ms | 3276 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 fore(i , n ) for(int i = 0 ; i < n; i++)
void Anna( int N, long long X, int K, int P[] )
{
srand(6661);
vector<int> final(N);
vector<bool> forbidden(N , 0);
vector<int> seq(N);
fore(i , N)
seq[i] = i;
random_shuffle(seq.begin() , seq.end());
fore(i , K)
forbidden[P[i]] = 1;
fore(i , N)
{
int cur = X%2;
if(forbidden[seq[i]] == 1)
continue;
X/=2;
if(cur == 0)
final[seq[i]] = 0;
else
final[seq[i]] = 1;
}
fore(i , N)
Set(i , final[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define pb push_back
#define Int long long
#define fore(i , n ) for(int i = 0 ; i < n; i++)
using namespace std;
long long Bruno( int N, int A[] ){
srand(6661);
vector<int> seq(N);
fore(i , N)
seq[i] = i;
random_shuffle(seq.begin() , seq.end());
vector<int> po;
fore(i , N)
{
if(A[seq[i]] == 1)
po.pb(1);
else
po.pb(0);
}
reverse(po.begin() , po.end());
Int X = 0;
for(auto x : po)
X = 2*X + x;
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |