Submission #897344

#TimeUsernameProblemLanguageResultExecution timeMemory
897344honanhphongCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define faster ios_base::sync_with_stdio(0); cin.tie(0); #define int long long using namespace std; using lli = long long; using ld = long double; using pii = pair <int, int>; mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 1e6 + 1000; const int mod = 1e9 + 7; int press(string p); string guess_sequence(int N) { string s = ""; char start; char cs[maxn]; if (press("AB") != 0) { if (press("A") == 1) { s += 'A'; start = 'A'; } else { s += 'A'; start = 'A'; } } else { if (press("X") == 1) { s += 'X'; start = 'X'; } else { s += 'Y'; start = 'Y'; } } if (start == 'A') { cs[0] = 'B'; cs[1] = 'X'; cs[2] = 'Y'; } else if (start == 'B') { cs[0] = 'A'; cs[1] = 'X'; cs[2] = 'Y'; } else if (start == 'X') { cs[0] = 'A'; cs[1] = 'B'; cs[2] = 'Y'; } else if (start == 'Y') { cs[0] = 'A'; cs[1] = 'B'; cs[2] = 'X'; } for (lli i = 1; i < N - 1; i ++) { lli lcm1 = press(s + cs[0]); lli lcm2 = press(s + cs[1]); lli lcm3 = press(s + cs[2]); if (lcm1 == s.length() + 1) s += cs[0]; else if (lcm2 == s.length() + 1) s += cs[1]; else s += cs[2]; } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(long long int)':
combo.cpp:64:18: warning: comparison of integer expressions of different signedness: 'lli' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         if (lcm1 == s.length() + 1) s += cs[0];
      |             ~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:65:23: warning: comparison of integer expressions of different signedness: 'lli' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |         else if (lcm2 == s.length() + 1) s += cs[1];
      |                  ~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:63:13: warning: unused variable 'lcm3' [-Wunused-variable]
   63 |         lli lcm3 = press(s + cs[2]);
      |             ^~~~
/usr/bin/ld: /tmp/ccnf7puB.o: in function `main':
grader.cpp:(.text.startup+0x4c): undefined reference to `guess_sequence[abi:cxx11](int)'
collect2: error: ld returned 1 exit status