Submission #941195

#TimeUsernameProblemLanguageResultExecution timeMemory
941195FIFI_cppCombo (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include <iostream> #include <vector> #include <algorithm> #include <numeric> #include <cstdlib> #include <cmath> #include <queue> #include <stack> #include <deque> #include <fstream> #include <iterator> #include <set> #include <map> #include <unordered_map> #include <iomanip> #include <cctype> #include <string> #include <cassert> #include <set> #include <bitset> #include <unordered_set> #include "combo.h" using ll = long long; #define pb push_back #define all(a) a.begin(),a.end() #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); // xcode cant include bits/stdc++.h using namespace std; //ifstream fin ("fenceplan.in"); //ofstream fout ("fenceplan.out"); string guess_sequence(int N) { string res = ""; string chars = "ABXY"; if (press("AB") >= 1) { if (press("A") == 1) { res += "A"; chars.erase(chars.begin()); } else { chars.erase(chars.begin() + 1); res += "B"; } } else { if (press("x") == 1) { res += "X"; chars.erase(chars.begin() + 2); } else { res += "Y"; chars.erase(chars.begin() + 3); } } for (int i = 1;i < N - 1;i++) { string ask = ""; char askc = chars[0]; for (int k = 0;k < 3;k++) { ask += res + askc + chars[k]; } ask += res + chars[1]; int x = press(ask); if (x == res.size() + 2) res += chars[0]; else if (x == res.size() + 1) res += chars[1]; else res += chars[2]; } if (press(res + chars[0]) == res.size() + 1) { res += chars[0]; } else if (press(res + chars[1]) == res.size() + 1) res += chars[1]; else res += chars[2]; return res; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:70:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |         if (x == res.size() + 2)
      |             ~~^~~~~~~~~~~~~~~~~
combo.cpp:72:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         else if (x == res.size() + 1)
      |                  ~~^~~~~~~~~~~~~~~~~
combo.cpp:77:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |     if (press(res + chars[0]) == res.size() + 1)
      |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:81:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |     else if (press(res + chars[1]) == res.size() + 1)
      |              ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...