제출 #1114946

#제출 시각아이디문제언어결과실행 시간메모리
1114946slumio콤보 (IOI18_combo)C++17
0 / 100
1 ms336 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long int; using ull = unsigned long long; /*I liked you once but not anymore now She's wearin' dresses on the border line (Lookin' good) Oh wakin' senses that were lost in time (Make amends) This liberation is the one they'll love for ages (Hey man, I see them comin')*/ string guess_sequence(int n) { string ans = ""; string s = ""; string p; if (press("AB")) { if (press("A")) ans = "A", s = "BXY"; else ans = "B", s = "AXY"; } else { if (press("X")) ans = "X", s = "ABY"; else ans = "Y", s = "AXB"; } for (int i = 1; i <= n - 1; i++) { p = ans + s[0] + s[1] + ans + s[0] + s[2] + ans + s[0] + s[0] + ans + s[1]; int mp = press(p); if (mp == ans.size() + 2) { ans.push_back(s[0]); } else if (mp == ans.size() + 1) { ans.push_back(s[1]); } else ans.push_back(s[2]); } if (ans.size() < n) { p = ans + s[0]; if (press(p) == n) { ans.push_back(s[0]); return ans; } p = ans + s[1]; if (press(p) == n) { ans.push_back(s[1]); return ans; } ans.push_back(s[2]); return ans; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:16: 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 (mp == ans.size() + 2)
      |             ~~~^~~~~~~~~~~~~~~~~
combo.cpp:46:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         else if (mp == ans.size() + 1)
      |                  ~~~^~~~~~~~~~~~~~~~~
combo.cpp:54:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   54 |     if (ans.size() < n)
      |         ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...