Submission #97556

#TimeUsernameProblemLanguageResultExecution timeMemory
97556silxikysBroken Device (JOI17_broken_device)C++14
Compilation error
0 ms0 KiB
#include "Annalib.h" #include <vector> void Anna(int N, long long X, int K, int P[]) { int pos = 0; std::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 > 61) { 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" #include <vector> long long Bruno(int N, int A[]) { std::vector<int> ans; 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) { ans.push_back(0); } else { ans.push_back(1); } } long long res = 0; for (int i = 0; i < ans.size(); i++) { if (ans[i] == 1) { res += (1LL<<i); } } return res; }

Compilation message (stderr)

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:8:13: error: 'pos' was not declared in this scope
         if (pos > 60) continue;
             ^~~
Bruno.cpp:18:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < ans.size(); i++) {
                     ~~^~~~~~~~~~~~