Submission #349473

# Submission time Handle Problem Language Result Execution time Memory
349473 2021-01-17T16:09:56 Z ezdp Combo (IOI18_combo) C++14
0 / 100
21 ms 256 KB
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include<bits/stdc++.h>
#include<combo.h>
#include<ext/pb_ds/assoc_container.hpp>

#define endl '\n'
#define pb push_back
#define fr first
#define sc second
#define ll long long int
#define ld long double
#define bit(idx) idx&(-idx)
#define bin(x) bitset<32>(x)
#define all(A) A.begin(), A.end()
#define de(x) cout << #x << " = " << x << endl;
#define row vector<ll>
#define row_matrix vector<ll>
#define matrix vector<row_matrix>
#define ordered_set_T ll

using namespace std;
using namespace __gnu_pbds;

typedef tree<ordered_set_T, null_type, less<ordered_set_T>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
/// find_by_order(x) -> x-th element in the set
/// order_of_key(x)  -> how many elements are smaller than x
/// insert(x)		 -> inserts x into the set

string guess_sequence(int N){
	string ans, qry;
	ll tmp = press("AB");
	if(tmp){
		tmp = press("A");
		if(tmp) ans += 'A';
		else 	ans += 'B';
	}
	else{
		tmp = press("X");
		if(tmp) ans += 'X';
		else 	ans += 'Y';
	}
	if(N == 1) return ans;
	vector<char> v;
	if(ans != "A") v.pb('A'); 
	if(ans != "B") v.pb('B');
	if(ans != "X") v.pb('X');
	if(ans != "Y") v.pb('Y');
	for(int i = 2; i <= N - 1; i ++){
		qry.clear();
		qry += ans; qry += v[0]; qry += ans; qry += v[1]; qry += v[0]; qry += ans; qry += v[1]; qry += v[1]; qry += v[1]; qry += v[2];
		tmp = press(qry);
		if(tmp == ans.size() + 0) ans += v[2];
		if(tmp == ans.size() + 1) ans += v[0];
		if(tmp == ans.size() + 2) ans += v[1];
	}
	qry.clear(); qry += ans; qry += v[0]; qry += ans; qry += v[1];
	tmp = press(qry);
	if(tmp == ans.size() + 1){
		qry.clear(); qry += ans; qry += v[0];
		tmp = press(qry);
		if(tmp == ans.size() + 1) ans += v[0];
		else ans += v[1];
	}
	else ans += v[2];
	return ans;
}
/**

*/

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:54:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |   if(tmp == ans.size() + 0) ans += v[2];
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:55:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   if(tmp == ans.size() + 1) ans += v[0];
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:56:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   if(tmp == ans.size() + 2) ans += v[1];
      |      ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:60:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |  if(tmp == ans.size() + 1){
      |     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:63:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |   if(tmp == ans.size() + 1) ans += v[0];
      |      ~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 256 KB Output is correct
5 Correct 1 ms 200 KB Output is correct
6 Incorrect 1 ms 200 KB Wrong Answer: wrong guess.
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 200 KB Output is correct
6 Correct 1 ms 256 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 0 ms 200 KB Output is correct
12 Correct 0 ms 200 KB Output is correct
13 Correct 0 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 1 ms 200 KB Output is correct
17 Incorrect 21 ms 200 KB Wrong Answer: wrong guess.
18 Halted 0 ms 0 KB -