제출 #630465

#제출 시각아이디문제언어결과실행 시간메모리
630465NintsiChkhaidze콤보 (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include "combo.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

vector <char> v = {'A', 'B', 'X', 'Y'},w;
string guess_sequence(int N) {
  string S = "";
  while (S.size()!=N) {
    for (char c: v){
      string P = S + c;
      if (press(P) == 1) {
        S = P; 
        break;
      }
    }
    char f = S[0];
  
    for (auto c: v)
        if (c!=f) w.pb(c);
    
    while (S.size() < N){
      string p = S + w[0] + S + w[1] + w[2] + S + w[1] + w[0];
      int coins = press(p),s = S.size();
      if (coins == s) S += w[2];
      else if (coins == s + 1) S += w[0];
      else if (coins == s + 2) S += w[1];
    }
  }

  return S;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |   while (S.size()!=N) {
      |          ~~~~~~~~^~~
combo.cpp:22:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |     while (S.size() < N){
      |            ~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...