제출 #600577

#제출 시각아이디문제언어결과실행 시간메모리
600577enerelt14콤보 (IOI18_combo)C++17
0 / 100
2 ms464 KiB
#include "combo.h" #include<bits/stdc++.h> #define pb push_back using namespace std; int n; string guess_sequence(int N){ string ans; n=N; string p; string x; for (int i=0;i<n;i++){ if (i==0){ p+='A'; for (int i=1;i<4*n;i++)p+='B'; if (press(p)>0){ p.clear(); for (int i=0;i<4*n;i++)p+='A'; if (press(p)>0){ ans+='A'; x='BXY'; } else{ ans+='B'; x='AXY'; } p.clear(); continue; } p.clear(); for (int i=0;i<4*n;i++)p+='X'; if (press(p)>0){ ans+='X'; x='ABY'; } else{ ans+='Y'; x='ABX'; } p.clear(); continue; } if (i==n-1){ p+=ans; for (int i=ans.size();i<4*n;i++)p+=x[0]; if (press(p)){ ans+=x[0]; return ans; } p.clear(); p+=ans; for (int i=ans.size();i<4*n;i++)p+=x[1]; if (press(p)){ ans+=x[1]; return ans; } ans+=x[2]; return ans; } for (int i=0;i<4;i++){ p+=ans; if (i==0){ p+=x[0]; for (int i=ans.size()+1;i<n;i++)p+=ans[0]; continue; } p+=x[1]; p+=x[i-1]; for (int i=ans.size()+2;i<n;i++)p+=ans[0]; } int y=press(p); if (y==ans.size())ans+=x[2]; if (y==ans.size()+1)ans+=x[0]; if (y==ans.size()+2)ans+=x[1]; } }

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

combo.cpp:20:23: warning: multi-character character constant [-Wmultichar]
   20 |                     x='BXY';
      |                       ^~~~~
combo.cpp:24:23: warning: multi-character character constant [-Wmultichar]
   24 |                     x='AXY';
      |                       ^~~~~
combo.cpp:33:19: warning: multi-character character constant [-Wmultichar]
   33 |                 x='ABY';
      |                   ^~~~~
combo.cpp:37:19: warning: multi-character character constant [-Wmultichar]
   37 |                 x='ABX';
      |                   ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:23: warning: overflow in conversion from 'int' to 'char' changes value from '4347993' to ''Y'' [-Woverflow]
   20 |                     x='BXY';
      |                       ^~~~~
combo.cpp:24:23: warning: overflow in conversion from 'int' to 'char' changes value from '4282457' to ''Y'' [-Woverflow]
   24 |                     x='AXY';
      |                       ^~~~~
combo.cpp:33:19: warning: overflow in conversion from 'int' to 'char' changes value from '4276825' to ''Y'' [-Woverflow]
   33 |                 x='ABY';
      |                   ^~~~~
combo.cpp:37:19: warning: overflow in conversion from 'int' to 'char' changes value from '4276824' to ''X'' [-Woverflow]
   37 |                 x='ABX';
      |                   ^~~~~
combo.cpp:71:14: 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 (y==ans.size())ans+=x[2];
      |             ~^~~~~~~~~~~~
combo.cpp:72:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         if (y==ans.size()+1)ans+=x[0];
      |             ~^~~~~~~~~~~~~~
combo.cpp:73:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |         if (y==ans.size()+2)ans+=x[1];
      |             ~^~~~~~~~~~~~~~
combo.cpp:9:12: warning: control reaches end of non-void function [-Wreturn-type]
    9 |     string p;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...