제출 #739001

#제출 시각아이디문제언어결과실행 시간메모리
739001raul2008487콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define pb push_back using namespace std; #include "combo.h" std::string guess_sequence(int N) { std::string s=""; int cc=1,st; int cs1=press("AB"),cs2=press("AX"); std::vector<char> vec; if(cs1==2){ s+="AB"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs2==2){ s+="AX"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1 && cs2==1){ s+="AY"; vec.pb('B'); vec.pb('X'); vec.pb('Y'); } else if(cs1==1){ s+='B'; vec.pb('A'); vec.pb('X'); vec.pb('Y'); } else if(cs2==1){ s+='X'; vec.pb('A'); vec.pb('B'); vec.pb('Y'); } else{ s+='Y'; vec.pb('B'); vec.pb('X'); vec.pb('A'); } st=s.size(); if(st==N){ return s; } for(int i=st;i<n-1;i++){ int query=press(s+vec[0]+s+vec[1]+vec[1]+s+vec[1]+vec[2]); if(query==(i+1)){ s+=vec[0]; } else if(query==(i+2)){ s+=vec[1]; } else{ s+=vec[2]; } } if(press(s+vec[0])==N){ return s+vec[0]; } else if(press(s+v[1])==N){ return s+vec[1]; } return s+vec[2]; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:51:20: error: 'n' was not declared in this scope
   51 |     for(int i=st;i<n-1;i++){
      |                    ^
combo.cpp:66:21: error: 'v' was not declared in this scope
   66 |     else if(press(s+v[1])==N){
      |                     ^
combo.cpp:8:9: warning: unused variable 'cc' [-Wunused-variable]
    8 |     int cc=1,st;
      |         ^~