# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131714 | MohamedAhmed04 | Broken Device (JOI17_broken_device) | C++14 | 59 ms | 3400 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>
void Anna( int N, long long X, int K, int P[] )
{
int mark[N+1] ;
for(int i = 0 ; i <= N ; ++i)
mark[i] = 0 ;
for(int i = 0 ; i < K ; ++i)
mark[P[i]] = 1;
for(int i = 0 ; i < N-1 ; i += 2)
{
if(mark[i])
mark[i+1] = 1 ;
if(mark[i+1])
mark[i] = 1 ;
}
int last = -1 ;
for(int i = 0 ; i < N ; i += 2)
{
last = i+1 ;
if(mark[i] || X == 0)
{
Set(i , 0) ;
Set(i+1 , 0) ;
continue ;
}
int now = X % 3 ;
X /= 3 ;
if(now == 0)
{
Set(i , 0) ;
Set(i+1 , 1) ;
}
else if(now == 1)
{
Set(i , 1) ;
Set(i+1 , 0) ;
}
else
{
Set(i , 1) ;
Set(i+1 , 1) ;
}
}
if(last < N-1)
Set(N-1 , 0) ;
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std ;
long long Bruno( int N, int A[] )
{
long long ans = 0ll ;
vector<int>v ;
for(int i = 0 ; i < N-1 ; i += 2)
{
if(A[i] == 0 && A[i+1] == 0)
continue ;
if(A[i] == 0 && A[i+1] == 1)
v.push_back(0) ;
else if(A[i] == 1 && A[i+1] == 0)
v.push_back(1) ;
else if(A[i] == 1 && A[i+1] == 1)
v.push_back(2) ;
}
reverse(v.begin() , v.end()) ;
for(auto &i : v)
ans = ans * 3ll + i * 1ll ;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |