Submission #1333032

#TimeUsernameProblemLanguageResultExecution timeMemory
1333032MrAndriaBroken Device (JOI17_broken_device)C++20
Compilation error
0 ms0 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 <vector>
#include <bits/stdc++.h>
#include "Brunolib.h"

vector <int> vec;
long long Bruno( int n, int a[]){
    
    for(int i=0;i<n;i++){
        vec.push_back(a[i]);
    }
    vec.push_back(0);
    long long pw=1;
    long long x=0;
    for(int i=0;i<n;i++){
        if(vec[i]==1){
            x+=pw;
            continue;
        }
        if(vec[i+1]==0){
            i++;
            continue;
        }
        if(vec[i+1]==1){
            if(pw<1000000000000000000)pw*=2;
        }
    }
    return x;
    
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bruno.cpp:5:1: error: 'vector' does not name a type
    5 | vector <int> vec;
      | ^~~~~~
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:9:9: error: 'vec' was not declared in this scope
    9 |         vec.push_back(a[i]);
      |         ^~~
Bruno.cpp:11:5: error: 'vec' was not declared in this scope
   11 |     vec.push_back(0);
      |     ^~~