제출 #213171

#제출 시각아이디문제언어결과실행 시간메모리
213171_Ice_Tea_콤보 (IOI18_combo)C++14
5 / 100
1 ms328 KiB
#include<bits/stdc++.h> #include "combo.h" #define de(x) if( x && x == MODE) #define MODE 0 using namespace std; string cht; string dic[4]; std::string guess_sequence(int N) { string S; int i, j; string p; p = "AB"; if( press(p) ) { p = "A"; if( press(p) ) S = "A"; else S = "B"; } else { p = "X"; if( press(p) ) S = "X"; else S = "Y"; } if( S == "A") { dic[0] = "BB"; dic[1] = "BX"; dic[2] = "BY"; dic[3] = "X"; cht = "BXY"; } else if( S == "B") { dic[0] = "AA"; dic[1] = "AX"; dic[2] = "AY"; dic[3] = "X"; cht = "AXY"; } else if( S == "X") { dic[0] = "AA"; dic[1] = "AB"; dic[2] = "AY"; dic[3] = "B"; cht = "ABY"; } else if( S == "Y") { dic[0] = "AA"; dic[1] = "AB"; dic[2] = "AX"; dic[3] = "B"; cht = "ABX"; } for( i=1; i<N-1; i++) { p = S + dic[0] + S + dic[1] + S + dic[2] + S + dic[3]; de(1) cout<<"ask>> "<<p<<"\n"; int q = press(p); if( q == i + 2) S.push_back(cht[0]); else if( q == i + 1) S.push_back(cht[1]); else S.push_back(cht[2]); de(1) cout << "S = " << S << "\n"; } p = S + cht[0] + S + cht[1]; if( press(p) == N) { p = S + cht[0]; if( press(p) == N) S.push_back(cht[0]); else S.push_back(cht[1]); } else { S.push_back(cht[2]); } assert( S.size() == N); return S; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:99:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   99 |     assert( S.size() == N);
      |             ~~~~~~~~~^~~~
combo.cpp:16:12: warning: unused variable 'j' [-Wunused-variable]
   16 |     int i, j;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...