Submission #254571

#TimeUsernameProblemLanguageResultExecution timeMemory
254571ErkhemkhuuCombo (IOI18_combo)C++17
5 / 100
3079 ms200 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair #define F first #define S second string guess_sequence(int n) { string res, seq; int i; if(press("A")) { res = "A"; seq = "BXY"; } if(press("B")) { res = "B"; seq = "AXY"; } if(press("X")) { res = "X"; seq = "ABY"; } if(press("Y")) { res = "Y"; seq = "ABX"; } for(i = 1; i < n - 1; i++) { string temp = ""; temp = res + seq[0]; temp += res + seq[1] + seq[0]; temp += res + seq[1] + seq[1]; temp += res + seq[1] + seq[2]; int ret = press(temp); if(ret == res.size() + 1) res += seq[0]; else if(ret == res.size() + 2) res += seq[1]; else res += seq[2]; } string temp = ""; for(i = 0; i < 3; i++) { res += seq[i]; if(press(res) == n) break; res.pop_back(); } if(res.size() != n) for(;;); return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:16: 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(ret == res.size() + 1) res += seq[0];
      |            ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:36:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |         else if(ret == res.size() + 2) res += seq[1];
      |                 ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:45:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   45 |     if(res.size() != n) for(;;);
      |        ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...