Submission #331268

#TimeUsernameProblemLanguageResultExecution timeMemory
331268pggp콤보 (IOI18_combo)C++14
97 / 100
49 ms604 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; int press(string t); string s; string guess_sequence(int N){ string cur = ""; string first = ""; if(press("A") == 1){ cur = "A"; } else if(press("B") == 1){ cur = "B"; } else if(press("X") == 1){ cur = "X"; } else{ cur = "Y"; } first = cur; if(N == 1){ return cur; } for (int i = 0; i < N - 2; ++i) { if(first == "A"){ int a = press(cur + "XY" + cur + "XX" + cur + "XB" + cur + "Y"); //cout << a << endl; if(a == cur.size()){ cur = cur + "B"; } if(a == cur.size() + 1){ cur = cur + "Y"; } if(a == cur.size() + 2){ cur = cur + "X"; } } if(first == "B"){ int a = press(cur + "XY" + cur + "XX" + cur + "XA" + cur + "Y"); if(a == cur.size()){ cur = cur + "A"; } if(a == cur.size() + 1){ cur = cur + "Y"; } if(a == cur.size() + 2){ cur = cur + "X"; } } if(first == "X"){ int a = press(cur + "AY" + cur + "AA" + cur + "AB" + cur + "Y"); //cout << a <<endl; if(a == cur.size()){ cur = cur + "B"; } if(a == cur.size() + 1){ cur = cur + "Y"; } if(a == cur.size() + 2){ cur = cur + "A"; } } if(first == "Y"){ int a = press(cur + "XA" + cur + "XX" + cur + "XB" + cur + "A"); if(a == cur.size()){ cur = cur + "B"; } if(a == cur.size() + 1){ cur = cur + "A"; } if(a == cur.size() + 2){ cur = cur + "X"; } } } if(first == "A"){ if(press(cur + "B") == N){ cur = cur + "B"; } else if(press(cur + "X") == N){ cur = cur + "X"; } else{ cur = cur + "Y"; } } else if(first == "B"){ if(press(cur + "A") == N){ cur = cur + "A"; } else if(press(cur + "X") == N){ cur = cur + "X"; } else{ cur = cur + "Y"; } } else if(first == "X"){ if(press(cur + "B") == N){ cur = cur + "B"; } else if(press(cur + "A") == N){ cur = cur + "A"; } else{ cur = cur + "Y"; } } else if(first == "Y"){ if(press(cur + "B") == N){ cur = cur + "B"; } else if(press(cur + "X") == N){ cur = cur + "X"; } else{ cur = cur + "A"; } } return cur; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:39:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:42:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:45:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:51:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:54:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:57:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:64:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:67:9: 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(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:70:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:76:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:79:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   79 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:82:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...