Submission #199755

#TimeUsernameProblemLanguageResultExecution timeMemory
199755detaomegaCombo (IOI18_combo)C++14
30 / 100
70 ms436 KiB
//#include "combo.h"
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
char used[4] = {'A', 'B', 'X', 'Y'};

string guess_sequence(int N) {
	string ans;
	int Not;
	int tmp = 3;
	int val;
	for(int i=0; i<3; i++) {
		val = press(ans + used[i]);
		if(val) {
			Not = i;
			ans += used[i];
			break;
		}
	}
	if(val == 0) {
		Not = 3;
		ans += 'Y';
		val = 1;
	}		
	vector<char> vt;
	for(int i=0; i<4; i++) {
		if(i == Not) continue;
		vt.push_back(used[i]);
	}
	for(int i=1; i<N; i++) {
		bool fg = 0;
		for(int j=0;j<vt.size()-1; j++) {
			int cmp = press(ans + vt[j]);
			if(cmp > val) {
				fg = 1;
				val++;
				ans+=vt[j];
				break;
			}
		}
		if(fg==0) {
			ans+=vt.back();
			val++;
		}
 	}
 	return ans;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for(int j=0;j<vt.size()-1; j++) {
      |               ~^~~~~~~~~~~~
combo.cpp:10:6: warning: unused variable 'tmp' [-Wunused-variable]
   10 |  int tmp = 3;
      |      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...