Submission #959168

#TimeUsernameProblemLanguageResultExecution timeMemory
959168AbitoBroken Device (JOI17_broken_device)C++17
41 / 100
30 ms2900 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
bool vis[155];
int t1=time(0);
void Anna( int n, long long X, int k, int p[] ){
    memset(vis,0,sizeof(vis));
    long long j=0;
    t1++;
    srand(t1);
    int x=rand()%2;
    //cout<<x<<endl;
    for (int i=0;i<k;i++) vis[p[i]]=1;
    if (x){
    for (int i=0;i<n;i+=2){
        if ((vis[i] && vis[i+1]) || j>=60LL){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        if ((X&(1LL<<j)) && vis[i+1]){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        if (X&(1LL<<j)){
            Set(i,0);
            Set(i+1,1);
            j++;
            continue;
        }
        if (!(X&(1LL<<j)) && vis[i]){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        Set(i,1);
        Set(i+1,0);
        j++;
    }return;}
    for (int i=0;i<n;i+=2){
        if ((vis[i] && vis[i+1]) || j>=60LL){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        if ((X&(1LL<<j)) && vis[i]){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        if (X&(1LL<<j)){
            Set(i,1);
            Set(i+1,0);
            j++;
            continue;
        }
        if (!(X&(1LL<<j)) && vis[i+1]){
            Set(i,0);
            Set(i+1,0);
            continue;
        }
        Set(i,0);
        Set(i+1,1);
        j++;
    }return;
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
int t2=time(0);
long long Bruno( int n, int a[] ){
    //for (int i=0;i<n;i++) cout<<a[i]<<' ';cout<<endl;
    t2++;
    srand(t2);
    int x=rand()%2;
    //cout<<x<<endl;
    long long X=0,j=0;
    if (x){
    for (int i=0;i<n;i+=2){
        if (!a[i] && !a[i+1]) continue;
        if (a[i+1]) X|=(1LL<<j);
        j++;
    }
    return X;}
    for (int i=0;i<n;i+=2){
        if (!a[i] && !a[i+1]) continue;
        if (a[i]) X|=(1LL<<j);
        j++;
    }return X;
}
#Verdict Execution timeMemoryGrader output
Fetching results...