Submission #231571

#TimeUsernameProblemLanguageResultExecution timeMemory
231571syyBroken Device (JOI17_broken_device)C++17
41 / 100
62 ms3328 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

void Anna(int n, long long x, int k, int p[]){
	bool ok[155], used[155];
	memset(ok, 1, sizeof ok);
	memset(used, 0, sizeof used);
	
	FOR(i, 0, k-1) ok[p[i]] = 0;
	ll cur = 0;
	FOR(i, 0, n-2) if (ok[i] and ok[i+1]) {
		Set(i, 1);
		Set(i+1, ((x >> cur) & 1));
		used[i] = 1; used[i+1] = 1;
		i++; cur++;
	}
	FOR(i, 0, n-1) if (!used[i]) Set(i, 0);
}
//#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(ll i = (ll)a; i <= (ll)b; i++)
#define DEC(i, a, b) for(ll i = (ll)a; i >= (ll)b; i--)
typedef pair<ll, ll> pi;
#define f first
#define s second
typedef vector<ll> vi;
typedef vector<pi> vpi;
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

long long Bruno(int n, int arr[] ){
	ll cur = 0; ll res = 0;
	FOR(i, 0, n-2) if (arr[i] == 1) {
		res += (ll) (((ll)arr[i+1]) << cur);
		i++; cur++;
		if (cur > 62) break;
	}
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...