Submission #280450

#TimeUsernameProblemLanguageResultExecution timeMemory
280450amalla콤보 (IOI18_combo)C++17
0 / 100
1 ms200 KiB
#include "combo.h"
#include<bits/stdc++.h>
     
using namespace std;
     
string guess_sequence(int N) {
    if (press("A")) {
        string M = "BXY", S = "A", control;
        if (N==1) return S;
        for (; S.size() < N ; ) {
            control = S+M[0]+M[0];
            control += S+M[0]+M[1];
            control += S+M[0]+M[2];
            control += S+M[1];
            int coins = press(control);
            if (coins==S.size()) S+=M[2];
            if (coins==S.size()+1) S+=M[1];
            if (coins==S.size()+2) S+=M[0];
        }
        return S;
    }
    else if (press("B")) {
        string M = "AXY", S = "B", control;
        if (N==1) return S;
        for (; S.size() < N ; ) {
            control = S+M[0]+M[0];
            control += S+M[0]+M[1];
            control += S+M[0]+M[2];
            control += S+M[1];
            int coins = press(control);
            if (coins==S.size()) S+=M[2];
            if (coins==S.size()+1) S+=M[1];
            if (coins==S.size()+2) S+=M[0];
        }
        return S;
    }
    else if (press("X")) {
        string M = "ABY", S = "X", control;
        if (N==1) return S;
        for (; S.size() < N ; ) {
            control = S+M[0]+M[0];
            control += S+M[0]+M[1];
            control += S+M[0]+M[2];
            control += S+M[1];
            int coins = press(control);
            if (coins==S.size()) S+=M[2];
            if (coins==S.size()+1) S+=M[1];
            if (coins==S.size()+2) S+=M[0];
        }
        return S;
    }
    else {
        string M = "ABX", S = "Y", control;
        if (N==1) return S;
        for (; S.size() < N ; ) {
            control = S+M[0]+M[0];
            control += S+M[0]+M[1];
            control += S+M[0]+M[2];
            control += S+M[1];
            int coins = press(control);
            if (coins==S.size()) S+=M[2];
            if (coins==S.size()+1) S+=M[1];
            if (coins==S.size()+2) S+=M[0];
        }
        return S;
    }
    
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:10:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |         for (; S.size() < N ; ) {
      |                ~~~~~~~~~^~~
combo.cpp:16:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             if (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |             if (coins==S.size()+1) S+=M[1];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:18:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             if (coins==S.size()+2) S+=M[0];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:25:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |         for (; S.size() < N ; ) {
      |                ~~~~~~~~~^~~
combo.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             if (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             if (coins==S.size()+1) S+=M[1];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |             if (coins==S.size()+2) S+=M[0];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:40:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |         for (; S.size() < N ; ) {
      |                ~~~~~~~~~^~~
combo.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |             if (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:47:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             if (coins==S.size()+1) S+=M[1];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:48:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             if (coins==S.size()+2) S+=M[0];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:55:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |         for (; S.size() < N ; ) {
      |                ~~~~~~~~~^~~
combo.cpp:61:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |             if (coins==S.size()) S+=M[2];
      |                 ~~~~~^~~~~~~~~~
combo.cpp:62:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |             if (coins==S.size()+1) S+=M[1];
      |                 ~~~~~^~~~~~~~~~~~
combo.cpp:63:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |             if (coins==S.size()+2) S+=M[0];
      |                 ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...