Submission #1333043

#TimeUsernameProblemLanguageResultExecution timeMemory
1333043MrAndriaBroken Device (JOI17_broken_device)C++20
0 / 100
17 ms1348 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
bool vis[10000];
string s;
void Anna( int n, long long x, int k, int p[]){
    // cout<<"YES "<<n<<endl;
    for(int i=0;i<k;i++){
        vis[p[i]]=1;
    }
    vis[n]=1;
    for(int i=0;i<n;i++){
        if(vis[i]==1 and vis[i+1]==1){
            Set(i,0);
            if(i!=n-1)Set(i+1,0);
            
            i++;
            continue;
        }
        if(x&1){
            if(vis[i]==0){
                // s.push_back('1');
                Set(i,1);
                x>>=1;
            }else{
                s.push_back('0');
                Set(i,0);
                // s.push_back('0');
                if(i!=n-1)Set(i+1,0);
                i++;
                continue;
            }
        }else{
            if(vis[i+1]==0){
                // s.push_back('0');
                Set(i,0);
                // s.push_back('1');
                if(i!=n-1)Set(i+1,1);
                x>>=1;
                i++;
                continue;
            }else{
                // s.push_back('0');
                Set(i,0);
                // s.push_back('0');
                if(i!=n-1)Set(i+1,0);
                i++;
                continue;
            }
        }
    }
    // cout<<s<<endl;

}

// int main(){
//     ios_base::sync_with_stdio(false);
//     cin.tie(0);
//     cout.tie(0);
//     int n,k;
//     long long x;
//     int arr[k];
//     cin>>n>>x>>k;
//     for(int i=0;i<k;i++){
//         cin>>arr[i];
//     }
//     Anna(n,x,k,arr);
// }
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno( int n, int a[]){
    long long pw=1;
    long long x=0;
    for(int i=0;i<n;i++){
        if(a[i]==1){
            x+=pw;
            continue;
        }
        if(i==n-1){
            continue;
        }
        if(a[i+1]==0){
            i++;
            continue;
        }
        if(a[i+1]==1){
            if(pw<1000000000000000000)pw*=2;
        }
    }
    return x;
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...