제출 #835170

#제출 시각아이디문제언어결과실행 시간메모리
835170JoksimKaktus콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <cmath> #include <queue> #include <map> #include <algorithm> #include <iomanip> #include <set> #include <cassert> #include <cstdio> #include <string> using namespace std; string guess_sequence(int N){ string s = ""; vector <string> s0(4); s0[0] = "A";s0[1] = "B";s0[2] = "X";s0[3] = "Y"; vector <string> v(3); for(int i = 0;i < 3;i++){ if(press(s+s0[i]) == 1){ s += s0[i]; int ind = 0; for(int j = 0;j < 4;j++){ if(j == i){ continue; } v[ind] = s0[j]; ind++; } break; } } if(s == ""){ s += s0[3]; v[0] = "A"; v[1] = "B"; v[2] = "X"; } int lenght = 1; while(lenght < N-1){ string check =s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2]; int k = press(check); if(k == lenght){ s += v[2]; lenght++; }else if(k == lenght + 1){ s += v[0]; lenght++; }else{ s += v[1]; lenght++; } } for(int i = 0;i < 2;i++){ if(press(s+v[i]) == N){ s += v[i]; break; } } if(s.size() != N){ s += v[2]; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:22:12: error: 'press' was not declared in this scope
   22 |         if(press(s+s0[i]) == 1){
      |            ^~~~~
combo.cpp:44:17: error: 'press' was not declared in this scope
   44 |         int k = press(check);
      |                 ^~~~~
combo.cpp:57:12: error: 'press' was not declared in this scope
   57 |         if(press(s+v[i]) == N){
      |            ^~~~~
combo.cpp:62:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   62 |     if(s.size() != N){
      |        ~~~~~~~~~^~~~