제출 #1114945

#제출 시각아이디문제언어결과실행 시간메모리
1114945slumio콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.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:19:9: error: 'press' was not declared in this scope
   19 |     if (press("AB"))
      |         ^~~~~
combo.cpp:40:18: error: 'press' was not declared in this scope
   40 |         int mp = press(p);
      |                  ^~~~~
combo.cpp:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if (mp == ans.size() + 2)
      |             ~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         else if (mp == ans.size() + 1)
      |                  ~~~^~~~~~~~~~~~~~~~~
combo.cpp:53:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   53 |     if (ans.size() < n)
      |         ~~~~~~~~~~~^~~
combo.cpp:57:13: error: 'press' was not declared in this scope
   57 |         if (press(p) == n)
      |             ^~~~~
combo.cpp:64:13: error: 'press' was not declared in this scope
   64 |         if (press(p) == n)
      |             ^~~~~