제출 #1085370

#제출 시각아이디문제언어결과실행 시간메모리
1085370mingga콤보 (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define ln "\n" #define dbg(x) cout << #x << " = " << x << ln #define mp make_pair #define pb push_back #define fi first #define se second #define inf 2e18 #define fast_cin() \ ios_base::sync_with_stdio(false); \ cin.tie(NULL) #define out(file) freopen(file, "w", stdout) #define in(file) freopen(file, "r", stdin) #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) // #define int long long int MOD = 1e9 + 7; char d[4] = {'A', 'B', 'X', 'Y'}; string guess_sequence(int n) { string ans = ""; char fir; for(int i = 0; i < 4; i++) { string cur = ""; cur += d[i]; // cout << cur << ln; if(press(cur) == 1) { ans += d[i]; fir = d[i]; break; } } vector<char> vec; for(int i = 0; i < 4; i++) { if(d[i] == fir) continue; vec.pb(d[i]); } ans += 'A'; for(int i = 1; i < n; i++) { string tmp = ans + vec[0] + ans + vec[1]; // cout << tmp << ln; int cur = press(tmp); if(cur == sz(ans)) { ans += vec[2]; } else { string tmp = ans + vec[0]; int cur = press(tmp); if(cur == sz(ans)) ans += vec[1]; else ans += vec[0]; } } return ans; } signed main() { guess_sequence(4); }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:5: warning: 'fir' may be used uninitialized in this function [-Wmaybe-uninitialized]
   40 |     if(d[i] == fir) continue;
      |     ^~
/usr/bin/ld: /tmp/ccD4NGsf.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc4tqv2d.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status