답안 #627691

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627691 2022-08-12T18:49:47 Z MilosMilutinovic Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

bool broken[150];

void Anna(int N, long long X, int K, int P[])
{
	rep(i, 150) broken[i] = false;
	rep(i, K) broken[P[i]] = true;
 	int bit = 0;
 	for(int i = 0; i < N - 2; i += 3) {
 		vector<int> ids;
 		if(!broken[i]) ids.PB(i);
 		if(!broken[i + 1]) ids.PB(i + 1);
 		if(!broken[i + 2]) ids.PB(i + 2);
		if(bit <= 60 && (X >> bit & 1)) {
			if(ids.size() >= 2) {
				Set(ids[0], 1);
				Set(ids[1], 1);
				Set(ids[0] ^ ids[1] ^ i ^ (i + 1) ^ (i + 2), 0);
				bit ++;
			} else {
				Set(i, 0);
				Set(i + 1, 0);
				Set(i + 2, 0);
			}
		} else {
			if(!broken[i]) {
				Set(i, 1);
				Set(i + 1, 0);
				Set(i + 2, 0);
				bit ++;
			} else if(!broken[i + 1]) {
				Set(i, 0);
				Set(i + 1, 1);
				Set(i + 2, 0);
				bit ++;
			} else if(!broken[i + 2]) {
				Set(i, 0);
				Set(i + 1, 0);
				Set(i + 2, 1);
				bit ++;
			} else {
				Set(i, 0);
				Set(i + 1, 0);
				Set(i + 2, 0);
			}
		}
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

long long Bruno(int N, int A[])
{
	long long X = 0;
	int bit = 0;
	for(int i = 0; i < N - 2; i += 3) {
		int sum = A[i] + A[i + 1] + A[i + 2];
		if(sum == 2) {
			X += (1LL << bit);
			bit ++;
		} else if(sum == 1) {
			bit ++;
		}
	}
	return X;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:20:23: error: 'class std::vector<int>' has no member named 'PB'
   20 |    if(!broken[i]) ids.PB(i);
      |                       ^~
Anna.cpp:21:27: error: 'class std::vector<int>' has no member named 'PB'
   21 |    if(!broken[i + 1]) ids.PB(i + 1);
      |                           ^~
Anna.cpp:22:27: error: 'class std::vector<int>' has no member named 'PB'
   22 |    if(!broken[i + 2]) ids.PB(i + 2);
      |                           ^~