Submission #677130

#TimeUsernameProblemLanguageResultExecution timeMemory
677130hello_there_123Combo (IOI18_combo)C++17
0 / 100
1 ms436 KiB
#include<bits/stdc++.h> //#include "combo.h" using namespace std; string arr[4]={"A","B","X","Y"}; set<string>st; int press(string s); string guess_sequence(int N){ string ans = ""; string start = ""; st.insert("A"); st.insert("B"); st.insert("X"); st.insert("Y"); for(int i=0;i<3;i++){ if(press(arr[i]) == 1){ start = arr[i]; break; } } st.erase(start); vector<string>v; for(auto bru:st) v.push_back(bru); ans+=start; assert(ans.length() == 1); for(int i=0;i<N-2;i++){ string tr = ""; tr+=ans; tr+=v[0]; tr+=ans; tr+=v[1]; tr+=v[0]; tr+=ans; tr+=v[1]; tr+=v[1]; tr+=ans; tr+=v[1]; tr+=v[2]; if(press(tr) == ans.length()){ ans+=v[2]; } else if(press(tr) == ans.length()+1){ ans+=v[0]; } else ans+=v[1]; } assert(ans.length() == N-1); if(press(ans+v[0]) == N) return ans+v[0]; if(press(ans+v[1]) == N) return ans+v[1]; if(press(ans+v[2])==N) return ans+v[2]; assert(1); }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |   if(press(tr) == ans.length()){
      |      ~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:41:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |   else if(press(tr) == ans.length()+1){
      |           ~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp:47:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |    assert(ans.length() == N-1);
      |           ~~~~~~~~~~~~~^~~~~~
combo.cpp:8:15: warning: control reaches end of non-void function [-Wreturn-type]
    8 |  string ans = "";
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...