Submission #162491

#TimeUsernameProblemLanguageResultExecution timeMemory
162491abacabaCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define max3(a, b, c) max(a, max(b, c)) #define min3(a, b, c) min(a, min(b, c)) #define mp make_pair #define f first #define se second #define pb push_back #define ppb pop_back #define ll long long #define y1 abcde #define ull unsigned long long #define cntbit(x) __builtin_popcount(x) #define endl '\n' #define uset unordered_set #define umap unordered_map #define pii pair<int, int> #define ld long double #define pll pair<long long, long long> string seq[4] = {"A", "B", "X", "Y"}; int n, let1 = 3; string seq[4] = {"A", "B", "X", "Y"}; int n, let1 = 3; string guess_sequence(int N) { for(int i = 0; i < 3; ++i) if(press(seq[i])) { let1 = i; break; } string s = seq[let1]; swap(seq[3], seq[let1]); for(int i = 1; i + 1 < N; ++i) { string now = s + seq[0]; for(int j = 0; j < 3; ++j) now += s + seq[1] + seq[j]; int p = press(now); if(p == s.size()) s += seq[2]; else if(p == s.size() + 1) s += seq[0]; else s += seq[1]; } assert(s.size() == N - 1); for(int i = 0; i < 2; ++i) if(press(s + seq[i]) == N) return s + seq[i]; return s + seq[2]; }

Compilation message (stderr)

combo.cpp:26:8: error: redefinition of 'std::string seq [4]'
   26 | string seq[4] = {"A", "B", "X", "Y"};
      |        ^~~
combo.cpp:23:8: note: 'std::string seq [4]' previously declared here
   23 | string seq[4] = {"A", "B", "X", "Y"};
      |        ^~~
combo.cpp:27:5: error: redefinition of 'int n'
   27 | int n, let1 = 3;
      |     ^
combo.cpp:24:5: note: 'int n' previously declared here
   24 | int n, let1 = 3;
      |     ^
combo.cpp:27:8: error: redefinition of 'int let1'
   27 | int n, let1 = 3;
      |        ^~~~
combo.cpp:24:8: note: 'int let1' previously defined here
   24 | int n, let1 = 3;
      |        ^~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:14: 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(p == s.size())
      |            ~~^~~~~~~~~~~
combo.cpp:45:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         else if(p == s.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:1:
combo.cpp:50:21: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |     assert(s.size() == N - 1);
      |            ~~~~~~~~~^~~~~~~~