제출 #759189

#제출 시각아이디문제언어결과실행 시간메모리
759189ivaziva콤보 (IOI18_combo)C++14
97 / 100
22 ms592 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; long long n; string guess_sequence(int N) { n=N; if (n<=3) { ///test1 string s; char pocetno_slovo=' '; if (press("X")==1) pocetno_slovo='X'; else if (press("Y")==1) pocetno_slovo='Y'; else if (press("A")==1) pocetno_slovo='A'; else pocetno_slovo='B'; s.push_back(pocetno_slovo); for (long long i=2;i<=n;i++) { if (pocetno_slovo=='X') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='Y') { if (press(s+'X')==s.size()+1) s.push_back('X'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='A') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'X')==s.size()+1) s.push_back('X'); else s.push_back('B'); } if (pocetno_slovo=='B') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('X'); } } //cout<<s<<endl; return s; } else { string s; char pocetno_slovo=' '; if (press("X")==1) pocetno_slovo='X'; else if (press("Y")==1) pocetno_slovo='Y'; else if (press("A")==1) pocetno_slovo='A'; else pocetno_slovo='B'; s.push_back(pocetno_slovo); for (long long i=2;i<=n-1;i++) { if (pocetno_slovo=='X') { long long rez=press(s+'Y'+s+"AY"+s+"AA"+s+"AB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('Y'); else s.push_back('A'); } if (pocetno_slovo=='Y') { long long rez=press(s+'X'+s+"AX"+s+"AA"+s+"AB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('A'); } if (pocetno_slovo=='A') { /*string ss=s+'X'+s+"YX"+s+"YY"+s+"YB"; cout<<ss.size()<<endl;*/ long long rez=press(s+'X'+s+"YX"+s+"YY"+s+"YB"); if (rez==s.size()) s.push_back('B'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('Y'); } if (pocetno_slovo=='B') { long long rez=press(s+'X'+s+"YX"+s+"YY"+s+"YA"); if (rez==s.size()) s.push_back('A'); else if (rez==s.size()+1) s.push_back('X'); else s.push_back('Y'); } } for (long long i=1;i<=1;i++) { if (pocetno_slovo=='X') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='Y') { if (press(s+'X')==s.size()+1) s.push_back('X'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('B'); } if (pocetno_slovo=='A') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'X')==s.size()+1) s.push_back('X'); else s.push_back('B'); } if (pocetno_slovo=='B') { if (press(s+'Y')==s.size()+1) s.push_back('Y'); else if (press(s+'A')==s.size()+1) s.push_back('A'); else s.push_back('X'); } } //cout<<s<<endl; return s; } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:25:33: 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 (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:26:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:31:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |                 if (press(s+'X')==s.size()+1) s.push_back('X');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:32:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:37:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:38:38: 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 (press(s+'X')==s.size()+1) s.push_back('X');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:43:33: 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 (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:44:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:65:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:66:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |                 else if (rez==s.size()+1) s.push_back('Y');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:72:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:73:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:81:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |                 if (rez==s.size()) s.push_back('B');
      |                     ~~~^~~~~~~~~~
combo.cpp:82:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:88:24: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   88 |                 if (rez==s.size()) s.push_back('A');
      |                     ~~~^~~~~~~~~~
combo.cpp:89:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   89 |                 else if (rez==s.size()+1) s.push_back('X');
      |                          ~~~^~~~~~~~~~~~
combo.cpp:97:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:98:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   98 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:103:33: 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+'X')==s.size()+1) s.push_back('X');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:104:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  104 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:109:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:110:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  110 |                 else if (press(s+'X')==s.size()+1) s.push_back('X');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:115:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  115 |                 if (press(s+'Y')==s.size()+1) s.push_back('Y');
      |                     ~~~~~~~~~~~~^~~~~~~~~~~~
combo.cpp:116:38: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  116 |                 else if (press(s+'A')==s.size()+1) s.push_back('A');
      |                          ~~~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...