Submission #851462

#TimeUsernameProblemLanguageResultExecution timeMemory
851462_uros9Combo (IOI18_combo)C++17
5 / 100
1 ms500 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string za_prvoXposlednje(string tr){ if(press(tr+"A"+tr+"B")>tr.size()){ if(press(tr+"A")>tr.size()) return "A"; return "B"; } if(press(tr+"X")>tr.size()) return "X"; return "Y"; } string classic(string tr){ vector<string> moguci(0); if(tr[0]!='A')moguci.push_back("A"); if(tr[0]!='B')moguci.push_back("B"); if(tr[0]!='X')moguci.push_back("X"); if(tr[0]!='Y')moguci.push_back("Y"); int napredak=press(tr+moguci[0]+tr+moguci[1]+moguci[0]+tr+moguci[1]+moguci[1]+tr+moguci[1]+moguci[2])-tr.size(); if(napredak==1) return moguci[0]; if(napredak==2) return moguci[1]; return moguci[2]; } string guess_sequence(int N){ string rez=""; rez+=za_prvoXposlednje(rez); for(int i=1; i<N-1; i++) rez+=classic(rez); rez+=za_prvoXposlednje(rez); return rez; }

Compilation message (stderr)

combo.cpp: In function 'std::string za_prvoXposlednje(std::string)':
combo.cpp:5:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 |     if(press(tr+"A"+tr+"B")>tr.size()){
      |        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:6:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |         if(press(tr+"A")>tr.size())
      |            ~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:10:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     if(press(tr+"X")>tr.size())
      |        ~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...