답안 #718831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718831 2023-04-05T00:41:03 Z Hacv16 Broken Device (JOI17_broken_device) C++17
컴파일 오류
0 ms 0 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

void Anna(int N, ll X, int K, int P[]){
    vector<bool> blocked(N);

    for(int i = 0; i < K; i++){
        int curBit = P[i];
        blocked[curBit] = true;
    }

    for(int i = 0; i < N; i += 2){
        if(blocked[i] || (i != N - 1 && blocked[i + 1])){ Set(i, 0); Set(i + 1, 0); }
        else{ int bitOn = (bool)((1LL << j) & X); Set(i, 1); Set(i + 1, bitOn); }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

typedef long long ll;

ll Bruno(int N, int A[]){
  ll ans = 0;

  for(int i = 0, j = 0; i < N; i += 2){
    if(A[i] == 0) continue;
    ans |= (((ll) A[i + 1]) << j); j++;
  }

  return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:17:42: error: 'j' was not declared in this scope
   17 |         else{ int bitOn = (bool)((1LL << j) & X); Set(i, 1); Set(i + 1, bitOn); }
      |                                          ^