# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
990928 | MarwenElarbi | Broken Device (JOI17_broken_device) | C++17 | 25 ms | 2656 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;
void Anna( int N, long long X, int K, int P[] ){
vector<int> arr1={ 90, 36, 93, 2, 4, 76, 88, 104, 131, 144, 110, 71, 134, 135, 3, 11, 19, 49, 75, 67, 55, 20, 30, 117, 23, 107, 83, 100, 119, 21, 102, 92, 106, 111, 48, 89, 128, 84, 15, 147, 99, 42, 29, 44, 130, 94, 86, 77, 74, 139, 57, 28, 125, 46, 129, 142, 138, 34, 31, 85, 13, 103, 115, 63, 81, 14, 149, 47, 26, 116, 87, 6, 95, 140, 24 } ;
vector<int> arr2={ 148, 126, 62, 58, 17, 121, 65, 91, 41, 66, 80, 133, 56, 25, 43, 145, 136, 79, 141, 12, 16, 64, 38, 10, 143, 97, 1, 8, 51, 39, 146, 118, 109, 33, 112, 54, 18, 132, 69, 5, 113, 45, 98, 68, 40, 50, 32, 9, 122, 61, 72, 60, 124, 27, 96, 114, 78, 37, 70, 127, 52, 59, 7, 123, 101, 137, 108, 22, 73, 105, 82, 53, 35, 120, 0 } ;
int tab[N];
memset(tab,0,sizeof tab);
for (int i = 0; i < K; ++i)
{
tab[P[i]]=-1;
}
int convert[60];
long long a[60];
a[0]=1;
for (int i = 1; i < 60; ++i)
{
a[i]=a[i-1]*2;
}
long long y=59;
//cout << a[59]<<endl;
while(y>=0){
//cout <<X<<" "<<a[y]<<endl;
if(X>=a[y]){
X-=a[y];
convert[y]=1;
}else convert[y]=0;
y--;
}//cout <<endl;
int lst=0;
for (int i = 0; i < 75; i++)
{
if(lst>59) break;
if(convert[lst]==1){
if (tab[arr1[i]]!=-1&&tab[arr2[i]]!=-1)
{
tab[arr1[i]]=1;
tab[arr2[i]]=1;
lst++;
}
}else{
if (tab[arr1[i]]!=-1&&tab[arr2[i]]!=-1)
{
tab[arr1[i]]=0;
tab[arr2[i]]=1;
lst++;
}else if (tab[arr1[i]]!=-1)
{
tab[arr1[i]]=1;
tab[arr2[i]]=0;
lst++;
}else if(tab[arr2[i]]!=-1){
tab[arr2[i]]=1;
tab[arr1[i]]=0;
lst++;
}
}
}
for (int i = 0; i < N; ++i)
{
if(tab[i]==1) Set(i,1);
else Set(i,0);
}
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
long long Bruno( int N, int A[] ){
vector<int> arr1={ 90, 36, 93, 2, 4, 76, 88, 104, 131, 144, 110, 71, 134, 135, 3, 11, 19, 49, 75, 67, 55, 20, 30, 117, 23, 107, 83, 100, 119, 21, 102, 92, 106, 111, 48, 89, 128, 84, 15, 147, 99, 42, 29, 44, 130, 94, 86, 77, 74, 139, 57, 28, 125, 46, 129, 142, 138, 34, 31, 85, 13, 103, 115, 63, 81, 14, 149, 47, 26, 116, 87, 6, 95, 140, 24 } ;
vector<int> arr2={ 148, 126, 62, 58, 17, 121, 65, 91, 41, 66, 80, 133, 56, 25, 43, 145, 136, 79, 141, 12, 16, 64, 38, 10, 143, 97, 1, 8, 51, 39, 146, 118, 109, 33, 112, 54, 18, 132, 69, 5, 113, 45, 98, 68, 40, 50, 32, 9, 122, 61, 72, 60, 124, 27, 96, 114, 78, 37, 70, 127, 52, 59, 7, 123, 101, 137, 108, 22, 73, 105, 82, 53, 35, 120, 0 } ;
int lst=0;
long long x=0;
long long a[60];
a[0]=1;
for (int i = 1; i < 60; ++i)
{
a[i]=a[i-1]*2;
//cout <<a[i]<<endl;
}
for (int i = 0; i < 75; i++)
{
if(lst>59) break;
if(A[arr1[i]]==1&&A[arr2[i]]==1){
x+=a[lst];
lst++;
}else if(A[arr1[i]]==1||A[arr2[i]]==1){
lst++;
}
}
//cout <<x<<endl;
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |