제출 #1333035

#제출 시각아이디문제언어결과실행 시간메모리
1333035MrAndriaBroken Device (JOI17_broken_device)C++20
0 / 100
0 ms344 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
bool vis[10000];
void Anna( int n, long long x, int k, int p[]){
    for(int i=0;i<k;i++){
        vis[p[i]]=1;
    }
    vis[n+1]=1;
    for(int i=1;i<=n;i++){
        if(vis[i]==1 and vis[i+1]==1){
            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');
                Set(i+1,0);
                i++;
                continue;
            }
        }else{
            if(vis[i+1]==0){
                // s.push_back('0');
                Set(i,0);
                // s.push_back('1');
                Set(i+1,1);
                x>>=1;
                i++;
                continue;
            }else{
                // s.push_back('0');
                Set(i,0);
                // s.push_back('0');
                Set(i+1,0);
                i++;
                continue;
            }
        }
    }

}

// int main(){
//     ios_base::sync_with_stdio(false);
//     cin.tie(0);
//     cout.tie(0);
    
// }
#include "Brunolib.h"
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...