Submission #97553

# Submission time Handle Problem Language Result Execution time Memory
97553 2019-02-17T03:26:23 Z silxikys Broken Device (JOI17_broken_device) C++14
Compilation error
0 ms 0 KB
#include "Annalib.h"

void Anna(int N, long long X, int K, int P[]) {
    int pos = 0;
    vector<int> ans(N,-1);
    for (int i = 0; i < K; i++) {
        ans[P[i]] = 0;
    }
    for (int i = 0; i < N; i += 2) {
        if (ans[i] == 0 || ans[i+1] == 0) {
            ans[i] = 0;
            ans[i+1] = 0;
        }
        else {
            if (pos > 60) {
                ans[i] = 0;
                ans[i+1] = 0;
                continue;
            }
            int b = ((1LL<<pos) & X);
            if (b == 0) {
                ans[i] = 0;
                ans[i+1] = 1;
            }
            else {
                ans[i] = 1;
                ans[i+1] = 1;
            }
            pos++;
        }
    }
    for (int i = 0; i < N; i++) {
        assert(ans[i] == 0 || ans[i] == 1);
        Set(i,ans[i]);            
    }
}
#include "Brunolib.h"

long long Bruno(int N, int A[]) {
    long long ans = 0;
    int pos = 0;
    for (int i = 0; i < N; i += 2) {
        int r = A[i] * 2 + A[i+1];
        if (pos > 60) continue;
        if (r == 0) continue;
        else if (r == 1) {
            pos++;    
        }
        else {
            ans |= (1LL<<pos);
            pos++;
        }
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:5:5: error: 'vector' was not declared in this scope
     vector<int> ans(N,-1);
     ^~~~~~
Anna.cpp:5:12: error: expected primary-expression before 'int'
     vector<int> ans(N,-1);
            ^~~
Anna.cpp:7:9: error: 'ans' was not declared in this scope
         ans[P[i]] = 0;
         ^~~
Anna.cpp:10:13: error: 'ans' was not declared in this scope
         if (ans[i] == 0 || ans[i+1] == 0) {
             ^~~
Anna.cpp:33:16: error: 'ans' was not declared in this scope
         assert(ans[i] == 0 || ans[i] == 1);
                ^~~
Anna.cpp:33:9: error: 'assert' was not declared in this scope
         assert(ans[i] == 0 || ans[i] == 1);
         ^~~~~~
Anna.cpp:33:9: note: suggested alternative: 'short'
         assert(ans[i] == 0 || ans[i] == 1);
         ^~~~~~
         short