Submission #21339

# Submission time Handle Problem Language Result Execution time Memory
21339 2017-04-13T11:07:02 Z krauch Broken Device (JOI17_broken_device) C++14
Compilation error
0 ms 0 KB
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \  	| |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <assert.h>
#include "Annalib.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const long long ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const double eps = 1e-7;
const int N = 2e6 + 6;

void Anna(int n, ll X, int K, int a[]) {
	vector < int > vec;
	forn(i, 0, K - 1) {
		bad[a[i]] = 1;
	}
	forn(i, 0, n - 1) {
		if (!bad[i] && !bad[i + 1]) vec.eb(i++);
	}
	int ptr = 0;
	for (auto it : vec) {
		Set(it, 1);
		Set(it + 1, (X >> ptr) & 1);
		++ptr;
	}
}
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <assert.h>
#include "Brunolib.h"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const long long ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const double eps = 1e-7;
const int N = 2e6 + 6;

ll Bruno(int n, int a[]) {
	ll res = 0;
	int ptr = 0;
	forn(i, 0, n - 1) {
		if (a[i] == 1) {
			res |= (a[i + 1] << ptr);
			++ptr;
			++i;
		}
	}
	return res;
}

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:56:3: error: 'bad' was not declared in this scope
   bad[a[i]] = 1;
   ^
Anna.cpp:59:8: error: 'bad' was not declared in this scope
   if (!bad[i] && !bad[i + 1]) vec.eb(i++);
        ^