제출 #534376

#제출 시각아이디문제언어결과실행 시간메모리
534376MrDeboo콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> // #define int long long using namespace std; std::string guess_sequence(int n) { srand(time(NULL)); char f[]={'A','B','X','Y'}; string s; bool bl=0; for(auto &i:f){ string g; g+=i; if(press(g)!=0){bl=1;s+=i;break;} if(i=='X')break; } if(!bl)s+='Y'; vector<char>ve; for(auto &i:f)if(i!=s[0])ve.push_back(i); vector<char>v=ve; while(s.size()!=n){ bool bl=0; vector<bool>pick(3); map<char,bool>mp; for(int w=0;w<2;w++){ int f=rand()%3; while(pick(f))f=rand()%3; pick[f]=1; if(press(s+v[w]+v[f])==i+1){ s+=v[w]; mp[v[f]]=1; bl=1; break; } } if(!bl)s+=v.back(); vector<char>V; for(auto i:ve)if(!mp[i])V.push_back(i); ve=V; } return s; // std::string p = ""; // for (int i = 0; i < 4 * N; ++i) { // p += 'A'; // } // int coins = press(p); // std::string S = ""; // for (int i = 0; i < N; ++i) { // S += 'A'; // } // return S; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     while(s.size()!=n){
      |           ~~~~~~~~^~~
combo.cpp:26:25: error: no match for call to '(std::vector<bool>) (int&)'
   26 |             while(pick(f))f=rand()%3;
      |                         ^
combo.cpp:28:36: error: 'i' was not declared in this scope
   28 |             if(press(s+v[w]+v[f])==i+1){
      |                                    ^