Submission #1235433

#TimeUsernameProblemLanguageResultExecution timeMemory
1235433santi3223Coins (IOI17_coins)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "coins.h"
using namespace std;
#define ll int
#define vb vector<bool>
#define pb push_back
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define vl vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ed "\n"
#define all(aaa) aaa.begin(), aaa.end()
#define rall(aaa) aaa.rbegin(), aaa.rend()
ll MOD = 1e9+7;

std::vector<int> coin_flips(std::vector<int> b, int c){
	vl ref;
	ll x = c;
	for(ll i = 5; i >= 0; i--){
		//cout << x << " ";
		if(x - (1<<i) >= 0){
			ref.pb(1);
			x -= (1<<i);
		}
		else{
			ref.pb(0);
		}
	}
	reverse(all(ref));
	//cout << ed;
	vl fin;
	ff(i, 0, 6){
		if(b[i] != ref[i]){
			fin.pb(i);
		}
	}
	if(fin.empty()){
		fin.pb(40);
	}
	return fin;
	
}

int find_coin(std::vector<int> b) {
	ll trans = 0, mult = 1;
	ff(i, 0, 6){
		trans += b[i]*mult;
		mult*= 2;
	}
	cout << trans << ed;
	return trans;
}

/*
static string run_test() {
	int c;
	cin >> c;
	vector<int> b(64);
	for (int i = 0; i < 8; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < 8; j++) {
			b[i * 8 + j] = int(s[j] - '0');
		}
	}
	vector<int> flips = coin_flips(b, c);
	if ((int)flips.size() == 0) {
		return "0 turn overs";
	}
	for (int i = 0; i < (int)flips.size(); i++) {
		if (flips[i] < 0 || flips[i] > 63) {
			return "cell number out of range";
		}
		b[flips[i]] = 1 - b[flips[i]];
	}
	int coin = find_coin(b);
	if (coin != c) {
		return "wrong coin";
	}
	return "ok";
}

int main() {
	int tests;
	cin >> tests;
	for (int t = 1; t <= tests; t++) {
		string result = run_test();
		cout << "test #" << t << ": " << result << endl;
	}
	return 0;
}
/*

Compilation message (stderr)

coins.cpp:55:1: error: unterminated comment
   55 | /*
      | ^