Submission #1336029

#TimeUsernameProblemLanguageResultExecution timeMemory
1336029wedonttalkanymoreCoins (IOI17_coins)C++20
Compilation error
0 ms0 KiB
#include "coins.h"
#include <bits/stdc++.h>
/*
    Chang ki si xuyen man dem
    Di lac vao trong giac mong
*/
using namespace std;
using ll = long long;

//#define int long long
#define pii pair<ll, ll>
#define fi first
#define se second

const ll N = 5e5 + 5, inf = 1e18, mod = 1e9 + 7, block = 320, lim = 19;

//void make(int x) {
////	cout << x << ' ';
//	string s = "";
//	while(x > 0) {
//		int t = x % 2;
//		s += to_string(t);
//		x /= 2;
//	}
//	reverse(s.begin(), s.end());
//	while(s.size() < 6) s = "0" + s;
//	cout << "at: " << s << '\n';
//}

vector<int> coin_flips(vector<int> b, int c) {
    int flip = 0;
    for (int i = 0; i < b.size(); i++) {
    	if (b[i]) flip ^= i;
	}
	int pos = flip ^ c;
	cout << pos << '\n';
	make(flip), make(c);
	b[pos] ^= 1;
	return {pos};
}

int find_coin(vector<int> b) {
    int ans = 0;
    for (int i = 0; i < b.size(); i++) {
    	if (b[i]) ans ^= i;
	}
	return ans;
}

//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);
//	cout << "at: " << coin << '\n';
//	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;
//}
/*
3
0
11101101
01000010
01011010
11110101
11000010
01011101
01000110
10111111
7
01110010
11110101
00000100
10110001
00010111
00110101
00001110
10101110
7
10100010
01001011
10110101
10100111
00010110
01000010
00111110
01110100
*/

Compilation message (stderr)

coins.cpp: In function 'std::vector<int> coin_flips(std::vector<int>, int)':
coins.cpp:37:9: error: 'make' was not declared in this scope
   37 |         make(flip), make(c);
      |         ^~~~
grader.cpp: In function 'void shuffle(std::vector<int>&)':
grader.cpp:88:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<int*, vector<int> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   88 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:5:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~