Submission #99205

#TimeUsernameProblemLanguageResultExecution timeMemory
99205cfalasCombo (IOI18_combo)C++14
100 / 100
46 ms540 KiB
/* ______ _ _____ | ____/\ | | /\ / ____| | |__ / \ | | / \ | (___ | __/ /\ \ | | / /\ \ \___ \ | | / ____ \| |____ / ____ \ ____) | |_|/_/ \_\______/_/ \_\_____/ */ #include<bits/stdc++.h> using namespace std; #define ll long long #define INF 1000000 #define MOD 1000000007 typedef pair<ll, ll> ii; typedef vector<ll> vi; typedef pair<ii, ll> iii; typedef vector<ii> vii; #define F first #define S second #define mp make_pair #define endl '\n' #define priority_queue pq #include "combo.h" string guess_sequence(int N) { // Find first character in 2 moves char first; if(press("AB")>=1){ if(press("B")) first = 'B'; else first = 'A'; } else{ if(press("X")) first = 'X'; else first = 'Y'; } string s = ""; s+=first; if(N==1) return s; for(int i=1;i<N-1;i++){ if(first=='A'){ int ans = press(s + "X" + s + "BX" + s + "BB" + s + "BY"); if(ans==s.size()) s+="Y"; else if(ans==s.size()+1) s+="X"; else s+="B"; } if(first=='B'){ int ans = press(s + "X" + s + "AX" + s + "AA" + s + "AY"); if(ans==s.size()) s+="Y"; else if(ans==s.size()+1) s+="X"; else s+="A"; } if(first=='X'){ int ans = press(s + "A" + s + "BA" + s + "BB" + s + "BY"); if(ans==s.size()) s+="Y"; else if(ans==s.size()+1) s+="A"; else s+="B"; } if(first=='Y'){ int ans = press(s + "X" + s + "BX" + s + "BB" + s + "BA"); if(ans==s.size()) s+="A"; else if(ans==s.size()+1) s+="X"; else s+="B"; } } if(first=='A'){ if(press(s + "B" + s + "X")==s.size()+1){ if(press(s + "B")==s.size()+1) s+="B"; else s+="X"; } else s+="Y"; } if(first=='B'){ if(press(s + "A" + s + "X")==s.size()+1){ if(press(s + "A")==s.size()+1) s+="A"; else s+="X"; } else s+="Y"; } if(first=='X'){ if(press(s + "B" + s + "A")==s.size()+1){ if(press(s + "B")==s.size()+1) s+="B"; else s+="A"; } else s+="Y"; } if(first=='Y'){ if(press(s + "B" + s + "X")==s.size()+1){ if(press(s + "B")==s.size()+1) s+="B"; else s+="X"; } else s+="A"; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:56:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             if(ans==s.size())
      |                ~~~^~~~~~~~~~
combo.cpp:58:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |             else if(ans==s.size()+1)
      |                     ~~~^~~~~~~~~~~~
combo.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |             if(ans==s.size())
      |                ~~~^~~~~~~~~~
combo.cpp:67:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |             else if(ans==s.size()+1)
      |                     ~~~^~~~~~~~~~~~
combo.cpp:74:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |             if(ans==s.size())
      |                ~~~^~~~~~~~~~
combo.cpp:76:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |             else if(ans==s.size()+1)
      |                     ~~~^~~~~~~~~~~~
combo.cpp:83:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |             if(ans==s.size())
      |                ~~~^~~~~~~~~~
combo.cpp:85:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |             else if(ans==s.size()+1)
      |                     ~~~^~~~~~~~~~~~
combo.cpp:92:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   92 |         if(press(s + "B" + s + "X")==s.size()+1){
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:93:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   93 |             if(press(s + "B")==s.size()+1)
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:102:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  102 |         if(press(s + "A" + s + "X")==s.size()+1){
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:103:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  103 |             if(press(s + "A")==s.size()+1)
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:112:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  112 |         if(press(s + "B" + s + "A")==s.size()+1){
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:113:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  113 |             if(press(s + "B")==s.size()+1)
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:122:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  122 |         if(press(s + "B" + s + "X")==s.size()+1){
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:123:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  123 |             if(press(s + "B")==s.size()+1)
      |                ~~~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...