# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
852157 | Rafi22 | Broken Device (JOI17_broken_device) | C++14 | 38 ms | 2820 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 <bits/stdc++.h>
#include "Annalib.h"
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
//int inf=1000000007;
//int mod=1000000007;
//int mod1=998244353;
bool bad[157];
int res[157];
void Anna(int n,ll x,int k,int P[])
{
srand(213769);
vector<int>ord;
for(int i=0;i<150;i++) ord.pb(i);
random_shuffle(all(ord));
for(int i=0;i<150;i++)
{
res[i]=0;
bad[i]=0;
}
for(int i=0;i<k;i++) bad[P[i]]=1;
for(int i=0;i<150;i+=2)
{
if(bad[ord[i]]||bad[ord[i+1]]) continue;
if(x%3==0||x%3==2) res[ord[i]]=1;
if(x%3==1||x%3==2) res[ord[i+1]]=1;
x/=3;
}
for(int i=0;i<150;i++) Set(i,res[i]);
}
#include <bits/stdc++.h>
#include "Brunolib.h"
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
//int inf=1000000007;
//int mod=1000000007;
//int mod1=998244353;
ll Bruno(int n,int a[])
{
srand(213769);
vector<int>ord;
for(int i=0;i<150;i++) ord.pb(i);
random_shuffle(all(ord));
ll wyn=0,p=1;
for(int i=0;i<150;i+=2)
{
if(a[ord[i]]==0&&a[ord[i+1]]==0) continue;
if(a[ord[i]]==0&&a[ord[i+1]]==1) wyn+=p;
if(a[ord[i]]==1&&a[ord[i+1]]==1) wyn+=2*p;
p*=3;
}
return wyn;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |