Submission #1172440

#TimeUsernameProblemLanguageResultExecution timeMemory
1172440eggx50000콤보 (IOI18_combo)C++20
Compilation error
0 ms0 KiB
//#include "combo.h" #include <string> #include <iostream> #include <random> #include <assert.h> using namespace std; char ci[4] = {'A', 'B', 'X', 'Y'}; string S; int N; int press(string p) { int len = p.length(); if (len < 0 || len > 4 * N) { cout << "goo"; } for (int i = 0; i < len; ++i) { if (p[i] != 'A' && p[i] != 'B' && p[i] != 'X' && p[i] != 'Y') { cout << "goo"; } } int coins = 0; for (int i = 0, j = 0; i < len; ++i) { if (j < N && S[j] == p[i]) { ++j; } else if (S[0] == p[i]) { j = 1; } else { j = 0; } coins = std::max(coins, j); } return coins; } int upr(int n, string kr){ assert(kr.size() <= 4 * n); return press(kr); } string guess_sequence(int N) { string ab = "AB"; string ret = ""; char x = 0, y = 0, z = 0; if(upr(N, ab) >= 1){ if(upr(N, "A") == 1) ret += 'A'; else ret += 'B'; } else{ if(upr(N, "X") == 1) ret += 'X'; else ret += 'Y'; } for(int i = 0; i < 4; i ++){ if(ci[i] == ret[0]) continue; if(x == 0) x = ci[i]; else if(y == 0) y = ci[i]; else z = ci[i]; } for(int i = 2; i <= N; i ++){ if(i == N){ if(upr(N, ret + x) == N) ret += x; else if(upr(N, ret + y) == N) ret += y; else ret += z; } else{ string chk; chk += (ret + x + x); chk += (ret + x + y); chk += (ret + x + z); chk += (ret + y); int pr = upr(N, chk); if(pr >= i + 1) ret += x; else if(pr == i) ret += y; else ret += z; } } //cout << ret; return ret; } int main() { cin >> S; N = S.size(); string kr = guess_sequence(N); cout << (kr == S); return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccNSTimG.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc8H5ztm.o:combo.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccNSTimG.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8H5ztm.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status