제출 #613137

#제출 시각아이디문제언어결과실행 시간메모리
613137ajpianoHicCup (FXCUP4_hiccup)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "hiccup.h" using namespace std; #define f first #define s second int HicCup(std::string S) { int N = S.size(); int hbef = 0; for(int i = 0; i < N; i++){ if(S[i] == '!'){ if(i == 0 || S[i-1] == 'H') return -1; } else if(S[i] == 'H') hbef++; else{ hbef--; if(hbef < 0) return -1; } } if(hbef != 0) return -1; int l = 0, r = 1000000; while(r-l > 1){ int mid = (l+r)>>1; vector<pair<int,bool>> stk; //! points. Complete bool good = 1; for(int i = 0; i < N; i++){ if(S[i] == 'H'){ stk.push_back({0,0}); }else if(S[i] == 'C'){ while(stk.back().s == 1){ if(stk.back().f < mid) good = 0; stk.pop_back(); } stk.back().s = 1; }else{ if(stk.empty() || stk.back().s == 0) continue; else stk.back().f++; if(stk.back().f >= mid) stk.pop_back(); } } for(auto &a: stk){ if(a.f < mid) good = 0; } if(good) l = mid; else r = mid; } return l; } int main(){ string s; cin >> s; cout << HicCup(s) << "\n"; }

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

/usr/bin/ld: /tmp/ccC9sbSx.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccq6KZqx.o:hiccup.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status