Submission #1019975

#TimeUsernameProblemLanguageResultExecution timeMemory
1019975CodeAssignmentCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define trav(a, x) for (auto &a : x)
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

string guess_sequence(int N) {
	ll n = N;
	vector<char> l = {'A', 'B', 'X', 'Y'};

	int coin;
	auto query = [&](string q) -> void {
		coin = press(q);
	};

	string st = "Y";
	string s = st;
	rep(i, 0, sz(l) - 1) {
		query(string(n, l[i]));
		if (coin > 0) {
			s = "";
			s += l[i];
			break;
		}
	}
	
	vector<char> chars;
	trav(c, l) if (c != s[0]) chars.pb(c);

	rep(i, 0, n-1) {
		shuffle(all(chars), rnd);
		bool found = 0;
		rep(j, 0, sz(chars) - 1) {
			string temp = s;
			temp += chars[0];
			while(sz(temp) < n) temp += st;
			query(temp);
			if (coin == sz(s) + 1) {
				s += chars[0];
				found = 1;
				continue;
			}
		}
		if (!found) s += chars[1];
	}
	return s;
}

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccz4dZ3k.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccMXFm3h.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status