제출 #339598

#제출 시각아이디문제언어결과실행 시간메모리
339598ogibogi2004콤보 (IOI18_combo)C++14
100 / 100
44 ms516 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { /*string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; } return S;*/ string p=""; string s=""; vector<char>v; p="AB"; int xd=press(p); if(xd==0) { xd=press("X"); if(xd==0)s+="Y"; else s+="X"; } else { xd=press("A"); if(xd==0)s+="B"; else s+="A"; } if(s[0]!='A')v.push_back('A'); if(s[0]!='X')v.push_back('X'); if(s[0]!='Y')v.push_back('Y'); if(s[0]!='B')v.push_back('B'); if(N==1) { return s; } for(int i=1;i+1<N;i++) { p=""; p+=s;p+=v[0]; p+=s;p+=v[1];p+=v[0]; p+=s;p+=v[1];p+=v[1]; p+=s;p+=v[1];p+=v[2]; xd=press(p); if(xd==s.size()) { s+=v[2]; } else if(xd==s.size()+1) { s+=v[0]; } else { s+=v[1]; } } p=s; p+=v[0]; xd=press(p); if(xd==N)return p; p=s; p+=v[1]; xd=press(p); if(xd==N)return p; p=s; p+=v[2]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:48:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |    if(xd==s.size())
      |       ~~^~~~~~~~~~
combo.cpp:52:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |    else if(xd==s.size()+1)
      |            ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...