Submission #553229

#TimeUsernameProblemLanguageResultExecution timeMemory
553229sandry24콤보 (IOI18_combo)C++17
10 / 100
52 ms456 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

int press(std::string p);

string guess_sequence(int n){
    string temp = "";
    while(temp.size() != n){
        int gotten_points = 0;
        if(temp[0] != 'A' && !gotten_points){
            string temp2 = temp + "A";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }
        } 
        if(temp[0] != 'B' && !gotten_points){
            string temp2 = temp + "B";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
        if(temp[0] != 'X' && !gotten_points){
            string temp2 = temp + "X";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
        if(temp[0] != 'Y' && !gotten_points){
            string temp2 = temp + "Y";
            if(press(temp2) == temp2.size()){
                temp = temp2;
                gotten_points = 1;
            }

        }
    }
    return temp;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(temp.size() != n){
      |           ~~~~~~~~~~~~^~~~
combo.cpp:20:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:27:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:35:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:43:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             if(press(temp2) == temp2.size()){
      |                ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...