제출 #851464

#제출 시각아이디문제언어결과실행 시간메모리
851464_uros9콤보 (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string za_prvo(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 za_poslednje(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"); if(press(tr+moguci[0]+tr+moguci[1])>tr.size()){ if(press(tr+moguci[0])>tr.size()) return moguci[0]; return moguci[1]; } return moguci[2]; } 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_prvo(rez); for(int i=1; i<N-1; i++) rez+=classic(rez); rez+=za_poslednje(rez); return rez; }

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

combo.cpp: In function 'std::string za_prvo(std::string)':
combo.cpp:6:28: 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+"B")>tr.size()){
      |        ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:7:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |         if(press(tr+"A")>tr.size())
      |            ~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:11:21: 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(press(tr+"X")>tr.size())
      |        ~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp: In function 'std::string za_poslednje(std::string)':
combo.cpp:21:40: 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(press(tr+moguci[0]+tr+moguci[1])>tr.size()){
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:22:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         if(press(tr+moguci[0])>tr.size())
      |            ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...