제출 #108510

#제출 시각아이디문제언어결과실행 시간메모리
108510abil콤보 (IOI18_combo)C++14
0 / 100
2 ms256 KiB
#include <bits/stdc++.h> #include "combo.h" #define mk make_pair #define sc second #define fr first #define pb push_back #define all(s) s.begin(), s.end() #define sz(s) ( (int)s.size() ) #define Scan(a) scanf ("%I64d", &a) #define scan(a) scanf ("%d", &a) using namespace std; const long long INF = (int)1e18 + 7; const int N = (int)1e5 + 12; const int mod = 1000000007; string guess_sequence(int N){ string s = "", s1 = "AB"; int cur = press(s1); if(cur == 2){ s = "A"; } else if(cur == 1){ cur = press("A"); if(cur == 1){ s = "A"; } else{ s = "B"; } } else{ s1 = "XY"; int cur = press(s1); if(cur == 2){ s = "X"; } else if(cur == 1){ cur = press("X"); if(cur == 1){ s = "X"; } else{ s = "Y"; } } } char ch = s[0]; if(s.size() == N){ return s; } else{ if(ch == 'A'){ while(s.size() < N - 1){ string s1 = s; s1.pb('B'); s1.pb('X'); s1 = s1 + s; s1.pb('B'); s1.pb('Y'); s1 = s1 + s; s1.pb('B'); s1.pb('B'); s1 = s1 + s; s1.pb('Y'); cur = press(s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } string s1 = s; s1.pb('X'); cur = press(s1); if(cur == s.size() + 1){ s.pb('X'); } else{ s1 = s; s1.pb('Y'); cur = press(s1); if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } return s; } if(ch == 'B'){ while(s.size() < N - 1){ string s1 = s; s1.pb('A'); s1.pb('X'); s1 = s1 + s; s1.pb('A'); s1.pb('Y'); s1 = s1 + s; s1.pb('A'); s1.pb('A'); s1 = s1 + s; s1.pb('Y'); cur = press(s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('A'); } } string s1 = s; s1.pb('X'); cur = press(s1); if(cur == s.size() + 1){ s.pb('X'); } else{ s1 = s; s1.pb('Y'); cur = press(s1); if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('A'); } } return s; } if(ch == 'X'){ while(s.size() < N){ string s1 = s; s1.pb('B'); s1.pb('A'); s1 = s1 + s; s1.pb('B'); s1.pb('Y'); s1 = s1 + s; s1.pb('B'); s1.pb('B'); s1 = s1 + s; s1.pb('Y'); cur = press(s1); if(cur == s.size()){ s.pb('A'); } else if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } string s1 = s; s1.pb('A'); cur = press(s1); if(cur == s.size() + 1){ s.pb('A'); } else{ s1 = s; s1.pb('Y'); cur = press(s1); if(cur == s.size() + 1){ s.pb('Y'); } else{ s.pb('B'); } } return s; } if(ch == 'Y'){ while(s.size() < N){ string s1 = s; s1.pb('B'); s1.pb('X'); s1 = s1 + s; s1.pb('B'); s1.pb('A'); s1 = s1 + s; s1.pb('B'); s1.pb('B'); s1 = s1 + s; s1.pb('A'); cur = press(s1); if(cur == s.size()){ s.pb('X'); } else if(cur == s.size() + 1){ s.pb('A'); } else{ s.pb('B'); } } string s1 = s; s1.pb('X'); cur = press(s1); if(cur == s.size() + 1){ s.pb('X'); } else{ s1 = s; s1.pb('A'); cur = press(s1); if(cur == s.size() + 1){ s.pb('A'); } else{ s.pb('B'); } } return s; } } }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |       if(s.size() == N){
      |          ~~~~~~~~~^~~~
combo.cpp:57:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   57 |                   while(s.size() < N - 1){
      |                         ~~~~~~~~~^~~~~~~
combo.cpp:70:32: 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(cur == s.size()){
      |                            ~~~~^~~~~~~~~~~
combo.cpp:74:32: 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(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:84:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:91:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:101:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |                   while(s.size() < N - 1){
      |                         ~~~~~~~~~^~~~~~~
combo.cpp:114:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  114 |                         if(cur == s.size()){
      |                            ~~~~^~~~~~~~~~~
combo.cpp:118:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  118 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:128:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  128 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:135:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  135 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:145:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  145 |                   while(s.size() < N){
      |                         ~~~~~~~~~^~~
combo.cpp:158:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  158 |                         if(cur == s.size()){
      |                            ~~~~^~~~~~~~~~~
combo.cpp:162:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  162 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:172:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  172 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:179:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  179 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:189:34: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  189 |                   while(s.size() < N){
      |                         ~~~~~~~~~^~~
combo.cpp:202:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  202 |                         if(cur == s.size()){
      |                            ~~~~^~~~~~~~~~~
combo.cpp:206:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  206 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:216:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  216 |                   if(cur == s.size() + 1){
      |                      ~~~~^~~~~~~~~~~~~~~
combo.cpp:223:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  223 |                         if(cur == s.size() + 1){
      |                            ~~~~^~~~~~~~~~~~~~~
combo.cpp:19:27: warning: control reaches end of non-void function [-Wreturn-type]
   19 |       string s = "", s1 = "AB";
      |                           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...