제출 #331275

#제출 시각아이디문제언어결과실행 시간메모리
331275pggp콤보 (IOI18_combo)C++14
100 / 100
51 ms600 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("AB") > 0){ if(press("A") == 1){ cur = "A"; } else{ 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; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:46:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:49:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:55:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:58:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:61:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:68:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   68 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:71:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |    if(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:74:9: 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(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:80:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |    if(a == cur.size()){
      |       ~~^~~~~~~~~~~~~
combo.cpp:83:9: 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(a == cur.size() + 1){
      |       ~~^~~~~~~~~~~~~~~~~
combo.cpp:86:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   86 |    if(a == cur.size() + 2){
      |       ~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...