제출 #433578

#제출 시각아이디문제언어결과실행 시간메모리
433578Apiram콤보 (IOI18_combo)C++14
5 / 100
3 ms292 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; std::string guess_sequence(int N) { int counts=0; string p; string k = "ABXY"; for (int i =0;i<4;++i){ if (press(p+k[i])>counts){ counts++; p+=k[i]; k.erase(i,1); break; } } set<string>pos; for (int i =0;i<3;++i){ for (int j =0;j<3;++j){ for (int l =0;l<3;++l){ string b; b+=k[i]; b+=k[j]; b+=k[l]; pos.insert(b); } } } while(p.length()<N){ for (auto c:pos){ int cost =press(p+c); if (cost>counts){ if (cost-counts==1){ counts++; p+=c[0]; break; } else if (cost-counts==2){ counts+=2; p+=c[0]; p+=c[1]; break; } else if (cost-counts==3){ counts+=3; p+=c[0]; p+=c[1]; p+=c[2]; break; } } } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   while(p.length()<N){
      |         ~~~~~~~~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...