제출 #1010216

#제출 시각아이디문제언어결과실행 시간메모리
1010216baotoan655콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #ifdef ONLINE_JUDGE #include "combo.h" #endif #define file(name) if (fopen(name".inp", "r")) { freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FOD(i, b, a) for(int i = (b); i >= (a); --i) #define ll long long #define fi first #define se second using namespace std; #ifndef ONLINE_JUDGE int press(string p) { // cout << p << '\n'; int x; cin >> x; return x; } #endif string guess_sequence(int N) { string s; if(press("AB")) { if(press("A")) s = "A"; else s = "B"; } else { if(press("X")) s = "X"; else s = "Y"; } vector<string> ve; for(string str : {"A", "B", "X", "Y"}) if(str != s) ve.emplace_back(str); while(s.size() < N) { // cout << s << ' '; string p; p = s; p += ve[0]; p += s; p += ve[1]; p += ve[0]; p += s; p += ve[1]; p += ve[1]; p += s; p += ve[1]; p += ve[2]; int res = press(p); int sz = s.size(); if(res == sz + 1) s += ve[0]; else if(res == sz + 2) s += ve[1]; else s += ve[2]; } return s; } #ifndef ONLINE_JUDGE int32_t main() { string s; cin >> s; string tmp = guess_sequence((int)s.size()); cout << tmp; } #endif

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:35:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |     while(s.size() < N) {
      |           ~~~~~~~~~^~~
/usr/bin/ld: /tmp/ccpXrh0c.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/cc1WUjFc.o:combo.cpp:(.text+0xc0): first defined here
/usr/bin/ld: /tmp/ccpXrh0c.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc1WUjFc.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status