제출 #438084

#제출 시각아이디문제언어결과실행 시간메모리
438084Bom164콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include<iostream> #include "combo.h" using namespace std; #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define mii map<int,int> #define pqb priority_queue<int> #define pqs priority_queue<int,vi,greater<int> > #define mod 1000000007 #define inf 1e18 #define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);s<e?x++:x--) #define w(x) int x; cin>>x; while(x--) string s=""; string guess_sequence(int n){ int cc=n; int A=press("A"); int B=press("B"); int X=press("X"); if(A==1) s+="A"; else if(B==1) s+="B"; else if(X==1) s+="X"; else s+="Y"; int ss = s.size(); if(s=="A"){ while(ss!=cc){ int c = press(s[ss-1]+"B"+s[ss-1]+"XB"+s[ss-1]+"XX"+s[ss-1]+"XY"); if(c==ss) s+="Y"; else if(c==ss+1) s+="B"; else s+="X"; ss=s.size(); } }else if(s=="B"){ while(ss!=cc){ int c = press(s[ss-1]+"A"+s[ss-1]+"XA"+s[ss-1]+"XX"+s[ss-1]+"XY"); if(c==ss) s+="Y"; else if(c==ss+1) s+="A"; else s+="X"; ss=s.size(); } }else if(s=="X"){ while(ss!=cc){ int c = press(s[ss-1]+"B"+s[ss-1]+"AB"+s[ss-1]+"AA"+s[ss-1]+"AY"); if(c==ss) s+="Y"; else if(c==ss+1) s+="B"; else s+="A"; ss=s.size(); } }else if(s=="Y"){ while(ss!=cc){ int c = press(s[ss-1]+"B"+s[ss-1]+"XB"+s[ss-1]+"XX"+s[ss-1]+"XA"); if(c==ss) s+="A"; else if(c==ss+1) s+="B"; else s+="X"; ss=s.size(); } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:34:46: error: invalid operands of types 'const char*' and 'const char [3]' to binary 'operator+'
   34 |             int c = press(s[ss-1]+"B"+s[ss-1]+"XB"+s[ss-1]+"XX"+s[ss-1]+"XY");
      |                                              ^~~~~
      |                                               |
      |                                               const char [3]
combo.cpp:42:46: error: invalid operands of types 'const char*' and 'const char [3]' to binary 'operator+'
   42 |             int c = press(s[ss-1]+"A"+s[ss-1]+"XA"+s[ss-1]+"XX"+s[ss-1]+"XY");
      |                                              ^~~~~
      |                                               |
      |                                               const char [3]
combo.cpp:50:46: error: invalid operands of types 'const char*' and 'const char [3]' to binary 'operator+'
   50 |             int c = press(s[ss-1]+"B"+s[ss-1]+"AB"+s[ss-1]+"AA"+s[ss-1]+"AY");
      |                                              ^~~~~
      |                                               |
      |                                               const char [3]
combo.cpp:58:46: error: invalid operands of types 'const char*' and 'const char [3]' to binary 'operator+'
   58 |             int c = press(s[ss-1]+"B"+s[ss-1]+"XB"+s[ss-1]+"XX"+s[ss-1]+"XA");
      |                                              ^~~~~
      |                                               |
      |                                               const char [3]