제출 #977250

#제출 시각아이디문제언어결과실행 시간메모리
977250aaaaaarroz콤보 (IOI18_combo)C++17
100 / 100
16 ms1900 KiB
#include <bits/stdc++.h> using namespace std; int press(string s); //Lo hizo el Nova string guess_sequence(int N){ string s, bottons = "ABXY", box; if(press("AB")){ if(press("A")) s = "A"; else s = "B"; } else{ if(press("X")) s = "X"; else s = "Y"; } for(char c: bottons){ if(c != s[0]) box.push_back(c); } if(N==1) return s; for(int i=0;i<N-2;i++){ string s2; char add; for(char c : box) s2 += s+box[2]+c; // abc (b, c, d) s0 abc, s1 abcc, s2 abcdb abcdc abcdd int x = press(s+box[1]+s2), y = s.size(); add = box[x-y]; s += add; } char add; if(press(s+box[0]) == s.size()+1) add = box[0]; else{ if(press(s+box[1]) == s.size()+1) add = box[1]; else add = box[2]; } s += add; return s; }

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

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