제출 #1007157

#제출 시각아이디문제언어결과실행 시간메모리
1007157andecaandeci콤보 (IOI18_combo)C++17
100 / 100
21 ms1788 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string s = ""; int tmp = press("AB"); if(tmp >= 1){ tmp = press("A"); if(tmp == 1){ s += 'A'; } else s += 'B'; } else{ tmp = press("X"); if(tmp == 1){ s += 'X'; } else s += 'Y'; } while(s.length()<n-1){ if(s[0] == 'X'){ tmp = press(s + 'B' + s + "AA" + s + "AY" + s + "AB"); if(tmp == s.length() + 1){ s += 'B'; } else if(tmp == s.length() + 2){ s += 'A'; } else s += 'Y'; } if(s[0] == 'Y'){ tmp = press(s + 'B' + s + "AA" + s + "AX" + s + "AB"); if(tmp == s.length() + 1){ s += 'B'; } else if(tmp == s.length() + 2){ s += 'A'; } else s += 'X'; } if(s[0] == 'A'){ tmp = press(s + 'B' + s + "XY" + s + "XX" + s + "XB"); if(tmp == s.length() + 1){ s += 'B'; } else if(tmp == s.length() + 2){ s += 'X'; } else s += 'Y'; } if(s[0] == 'B'){ tmp = press(s + 'A' + s + "XY" + s + "XX" + s + "XA"); if(tmp == s.length() + 1){ s += 'A'; } else if(tmp == s.length() + 2){ s += 'X'; } else s += 'Y'; } //cout<<s<<endl; } if(n >= 2){ tmp = press(s + "A" + s + "B"); if(tmp >= n){ tmp = press(s + 'A'); if(tmp == n){ s += 'A'; } else s += 'B'; } else{ tmp = press(s + 'X'); if(tmp == n){ s += 'X'; } else s += 'Y'; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     while(s.length()<n-1){
      |           ~~~~~~~~~~^~~~
combo.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |             if(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:28:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:38:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:20: 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(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:48:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             else if(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:55:20: 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(tmp == s.length() + 1){
      |                ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:58:25: 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(tmp == s.length() + 2){
      |                     ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...