Submission #1333030

#TimeUsernameProblemLanguageResultExecution timeMemory
1333030MrAndriaBroken 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.pb('1');
                Set(i,1);
                x>>=1;
            }else{
                // s.pb('0');
                Set(i,0);
                // s.pb('0');
                Set(i+1,0);
                i++;
                continue;
            }
        }else{
            if(vis[i+1]==0){
                // s.pb('0');
                Set(i,0);
                // s.pb('1');
                Set(i+1,1);
                x>>=1;
                i++;
                continue;
            }else{
                // s.pb('0');
                Set(i,0);
                // s.pb('0');
                Set(i+1,0);
                i++;
                continue;
            }
        }
    }

}

// int main(){
//     ios_base::sync_with_stdio(false);
//     cin.tie(0);
//     cout.tie(0);
    
// }
#include "Brunolib.h"
#include <bits/stdc++.h>
long long Bruno( int n, int a[]){
    vector <int> vec;
    for(int i=0;i<n;i++){
        vec.pb(a[i]);
    }
    vec.pb(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: In function 'long long int Bruno(int, int*)':
Bruno.cpp:4:5: error: 'vector' was not declared in this scope
    4 |     vector <int> vec;
      |     ^~~~~~
Bruno.cpp:4:5: note: suggested alternatives:
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from Bruno.cpp:2:
/usr/include/c++/13/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/13/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
Bruno.cpp:4:13: error: expected primary-expression before 'int'
    4 |     vector <int> vec;
      |             ^~~
Bruno.cpp:6:9: error: 'vec' was not declared in this scope
    6 |         vec.pb(a[i]);
      |         ^~~
Bruno.cpp:8:5: error: 'vec' was not declared in this scope
    8 |     vec.pb(0);
      |     ^~~