제출 #247465

#제출 시각아이디문제언어결과실행 시간메모리
247465stoyan_malinin콤보 (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include<iostream> #include<random> #include "combo.h" //#include "grader.cpp" using namespace std; int n; vector <char> v = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N) { n = N; int index = 1; string answer = ""; if(press("AB")>0) { if(press("A")>0) answer += "A"; else answer += "B"; } else { if(press("X")>0) answer += "X"; else answer += "Y"; } for(int i = 1;i<v.size();i++) { if(answer[0]==v[i]) { swap(v[0], v[i]); break; } } //cout << v[0] << " " << v[1] << " " << v[2] << " " << v[3] << '\n'; for(int i = 2;i<=n-1;i++) { string ask = answer+v[1]+v[1]+answer+v[1]+v[2]+answer+v[1]+v[3]+answer+v[2]; int res = press(ask); //cout << "f(" << ask << ") = " << res << '\n'; if(res==answer.size()+0) answer += v[3]; else if(res==answer.size()+1) answer += v[2]; else answer += v[1]; } if(press(answer+"A"+answer+"B")>answer.size()) { if(press(answer+"A")>answer.size()) answer += "A"; else answer += "B"; } else { if(press(answer+"X")>answer.size()) answer += "X"; else answer += "Y"; } return answer; } /* AXXXBBBBBBBBYYYYYYYXXXXXBXBBBBBBXXYYYYXXXXXBBYYYYXXXBBBBYYYYYYYBXBXBXBXBXBXBXBXBXBBXBXBBBXBXBXBBXBXXXYYXYYXXYYXYYXYYXYXYYXYYXYYXYXYXYBYXBYXYBXBXBYYBXYBXBYXBYXBYXYBXYBBYXYBXYBXXBYXYBXBYXYBXYBYBXYBXYBXYBBYXYBXYBYBXYBXYBYBYBXYBXYBXYYBXBYXYBXYBXYBYBXYBYXYBBYXBYXYBYBXYBYBXYBYBXYBYBXYYXYYXYXYYXYYXYXYXYYXYBYXYBXBBYXXBYXBYXYYBXYBYXYBXBBYXYBXBYXBYXYBXBYYBXYBXYBXYBXBXXXXYXYXYYXBXYBXYBXYXBYXBYXBXYBXYXBYXBXBBB */

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i = 1;i<v.size();i++)
      |                   ~^~~~~~~~~
combo.cpp:47:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         if(res==answer.size()+0) answer += v[3];
      |            ~~~^~~~~~~~~~~~~~~~~
combo.cpp:48:20: 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(res==answer.size()+1) answer += v[2];
      |                 ~~~^~~~~~~~~~~~~~~~~
combo.cpp:52:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     if(press(answer+"A"+answer+"B")>answer.size())
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:54:29: 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(press(answer+"A")>answer.size()) answer += "A";
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:59:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         if(press(answer+"X")>answer.size()) answer += "X";
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:15:9: warning: unused variable 'index' [-Wunused-variable]
   15 |     int index = 1;
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...