Submission #1006969

#TimeUsernameProblemLanguageResultExecution timeMemory
1006969christinelynnCombo (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "combo.h" using namespace __gnu_pbds; using namespace std; #define ll long long #define fi first #define se second #define endl '\n' template <typename T> using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>; const ll MOD = 1e9 + 7; const ll INF = 1e18; int n; string guess_sequence(int n){ string p = "AB", s = ""; if(press(p)){ p = "A"; if(press(p)) s += p; else s += "B"; } else { p = "X"; if(press(p)) s += p; else s += "Y"; } vector<char> ch; if(s[0] != 'A') ch.push_back('A'); if(s[0] != 'B') ch.push_back('B'); if(s[0] != 'X') ch.push_back('X'); if(s[0] != 'Y') ch.push_back('Y'); if(n % 2 == 0){ p = ""; p += s; p += ch[0]; p += s; p += ch[1]; if(press(p)){ p = s + ch[0]; if(press(p)){ s += ch[0]; } else { s += ch[1]; } } else { s += ch[2]; } } while(s.length() + 2 <= n){ p = ""; for(int i = 0; i < 3; i++){ p += s; p += s[0]; p += ch[i]; } p += s; p += ch[1]; if(press(p) == s.length() + 2){ s += ch[0]; } else if(press(p) == s.length() + 1){ s += ch[1]; } else { s += ch[2]; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:56:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   56 |     while(s.length() + 2 <= n){
      |           ~~~~~~~~~~~~~~~^~~~
combo.cpp:67:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |         if(press(p) == s.length() + 2){
      |            ~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:69:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |         } else if(press(p) == s.length() + 1){
      |                   ~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...