제출 #919581

#제출 시각아이디문제언어결과실행 시간메모리
919581Khanhcsp2콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> #define el '\n' #define fi first #define sc second #define int long long using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; const int mod=1e9+7; const int N=1e5+11; string guess_sequence(int n) { string s="ABXY", ans=""; int ch, pos; ch=press("AB"); if(ch) { int v=press("A"); if(v) pos=0; else pos=1; } else { int v=press("X"); if(v) pos=2; else pos=3; } ans+=s[pos]; swap(s[pos], s[3]); for(int i=1;i<n;i++) { int tmp=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1]; int l=press(tmp); if(l==i+2) ans+=s[0]; else if(l==i+1) ans+=s[1]; else ans+=s[2]; } if(press(ans+s[0])==n) return ans+s[0]; else if(press(ans+s[1])==n) return ans+s[1]; else return ans+s[2]; } //void sol() //{ // //} //signed main() //{ //// freopen("task.INP", "r", stdin); //// freopen("task.OUT", "w", stdout); // ios_base::sync_with_stdio(0); // cin.tie(0); // int t=1; // //cin >> t; // while(t--) // { // sol(); // } //}

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

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:34:62: error: cannot convert 'std::__cxx11::basic_string<char>' to 'long long int' in initialization
   34 |         int tmp=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1];
combo.cpp:35:21: error: could not convert 'tmp' from 'long long int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   35 |         int l=press(tmp);
      |                     ^~~
      |                     |
      |                     long long int