Submission #223717

# Submission time Handle Problem Language Result Execution time Memory
223717 2020-04-16T07:35:46 Z bharat2002 Combo (IOI18_combo) C++14
5 / 100
1 ms 200 KB
/*input

*/

#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
//Trace prints the name of the variable and the value.
void fl();
string ans;char fc;
string guess_sequence(int n)
{
	
	ans="";char arr[5]={'A', 'B', 'X', 'Y'};
	fl();
	char c1='0', c2='0', c3='0';
	for(int j=0;j<4;j++)
	{
		if(arr[j]==fc) continue;
		if(c1=='0') c1=arr[j];
		else if(c2=='0') c2=arr[j];
		else c3=arr[j];
	}
	for(int i=2;i<n;i++)
	{
		string temp=ans;temp+=c1;temp+=ans;temp+=c2;temp+=c1;temp+=ans;temp+=c2;temp+=c2;temp+=ans;temp+=c2;temp+=c3;
		int ct=press(temp);
		if(ct<i) ans+=c3;
		else if(ct==i) ans+=c1;
		else ans+=c2;
	}
	fl();
	return ans;
}
void fl()
{
	string temp=ans;
	temp+="A";temp+=ans;temp+="B";
	string t2;
	int ct=press(temp);
	ct-=ans.size();
	if(ct>0)
	{
		t2=ans;t2+="A";
		ct=press(t2);
		ct-=ans.size();
		if(ct>0)
		{
			fc='A';
			ans+="A";
		}
		else
		{
			ans+="B";fc='B';
		}	
	}
	else
	{
		t2=ans;t2+="X";
		ct=press(t2);ct-=ans.size();
		if(ct>0)
		{
			ans+="X";fc='X';
		}
		else
		{
			ans+="Y";fc='Y';
		}	
	}
}

/*
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	guess_sequence(3);
	cout<<"Answer:"<<ans;
}*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 1 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 1 ms 200 KB Output is correct
8 Correct 1 ms 200 KB Output is correct
9 Correct 1 ms 200 KB Output is correct
10 Correct 1 ms 200 KB Output is correct
11 Correct 1 ms 200 KB Output is correct
12 Correct 1 ms 200 KB Output is correct
13 Correct 1 ms 200 KB Output is correct
14 Correct 1 ms 200 KB Output is correct
15 Correct 1 ms 200 KB Output is correct
16 Correct 0 ms 200 KB Output is correct
17 Correct 1 ms 200 KB Output is correct
18 Correct 0 ms 200 KB Output is correct
19 Correct 1 ms 200 KB Output is correct
20 Correct 1 ms 200 KB Output is correct
21 Correct 1 ms 200 KB Output is correct
22 Correct 1 ms 200 KB Output is correct
23 Correct 1 ms 200 KB Output is correct
24 Correct 1 ms 200 KB Output is correct
25 Correct 1 ms 200 KB Output is correct
26 Correct 1 ms 200 KB Output is correct
27 Correct 1 ms 200 KB Output is correct
28 Correct 1 ms 200 KB Output is correct
29 Correct 1 ms 200 KB Output is correct
30 Correct 1 ms 200 KB Output is correct
31 Correct 1 ms 200 KB Output is correct
32 Correct 0 ms 200 KB Output is correct
33 Correct 1 ms 200 KB Output is correct
34 Correct 1 ms 200 KB Output is correct
35 Correct 1 ms 200 KB Output is correct
36 Correct 1 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 200 KB Wrong Answer: wrong guess.
2 Halted 0 ms 0 KB -