Submission #534408

#TimeUsernameProblemLanguageResultExecution timeMemory
534408YaserFaisalCombo (IOI18_combo)C++17
10 / 100
85 ms444 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence (int n)
{
    string cur = "" ;
    while(cur.size()<n)
    {
        if ( cur[0] != 'A' && press(cur+'A') == cur.size()+1 )
        {
            cur+='A' ;
            continue ;
        }
        if ( cur[0] != 'B' && press(cur+'B') == cur.size()+1 )
        {
            cur+='B' ;
            continue ;
        }
        if ( cur[0] != 'X' && press(cur+'X') == cur.size()+1 )
        {
            cur+='X' ;
            continue ;
        }
        if ( cur[0] != 'Y' && press(cur+'Y') == cur.size()+1 )
        {
            cur+='Y' ;
            continue ;
        }
    }
    return cur ;    
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:21: 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(cur.size()<n)
      |           ~~~~~~~~~~^~
combo.cpp:11:46: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |         if ( cur[0] != 'A' && press(cur+'A') == cur.size()+1 )
      |                               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:16:46: 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 ( cur[0] != 'B' && press(cur+'B') == cur.size()+1 )
      |                               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:21:46: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         if ( cur[0] != 'X' && press(cur+'X') == cur.size()+1 )
      |                               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:26:46: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         if ( cur[0] != 'Y' && press(cur+'Y') == cur.size()+1 )
      |                               ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...