제출 #1100384

#제출 시각아이디문제언어결과실행 시간메모리
1100384akzytr콤보 (IOI18_combo)C++17
5 / 100
1 ms376 KiB
#include <bits/stdc++.h> using namespace std; template <typename T> using ve = vector<T>; template <typename T, int sz> using ar = array<T, sz>; typedef long long ll; #define pb push_back #define fi first #define se second #define endl '\n' int press(string p); string guess_sequence(int N) { string s = ""; ve<char> lst; int sc=press("AB"); if(sc >= 1){ // In "AB // sc=press("A"); if(sc==1){ s = "A"; } else{ s ="B"; } } else{ sc=press("X"); if(sc==1){ s="X"; } else{ s="Y"; } } for(int i = 1; i < N - 1; i++) { ve<char> lst; for(char j : {'A', 'B', 'X', 'Y'}) { if(j == s[0]) { continue; } lst.pb(j); } string q = ""; q += s + lst[0]; q += s + lst[1] + lst[0]; q += s + lst[1] + lst[1]; q += s + lst[1] + lst[2]; int score = press(q); if(score == s.size() + 1) { s += lst[0]; } else if(score == s.size()) { s += lst[2]; } else if(score == s.size() + 2) { s += lst[1]; } } lst.clear(); sc=press(s+"A"+s+"B"); if(sc==N){ sc=press(s+"A"); if(sc==N){ s += "A"; } else{ s+="B"; } } else{ sc=press(s+"X"); if(sc==N){ s+="X"; } else{ s+="Y"; } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:56:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |   if(score == s.size() + 1) {
      |      ~~~~~~^~~~~~~~~~~~~~~
combo.cpp:58:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |   } else if(score == s.size()) {
      |             ~~~~~~^~~~~~~~~~~
combo.cpp:60:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |   } else if(score == s.size() + 2) {
      |             ~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...