제출 #963798

#제출 시각아이디문제언어결과실행 시간메모리
963798KakarotGlobal Warming (CEOI18_glo)C++98
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>#define int int64_tusing namespace std;void setIO() { cin.tie(0)->sync_with_stdio(0);}int lis(vector<int> &a, int i, int j) { vector<int> seq; for(int k = i; k < j+1; k++) { auto it = lower_bound(seq.begin(), seq.end(), a[k]); if(it == seq.end()) seq.push_back(a[k]); else *it = a[k]; } return seq.size();}void solve() { int n, x, ans = 0; cin >> n >> x; vector<int> a(n); for(auto &e : a) cin >> e; if(x == 0) { cout << lis(a, 0, n-1); return; } vector<int> plis(n), slis(n); for(int i = 0; i < n; i++) plis[i] = lis(a, 0, i); for(int i = n-1; i > -1; i--) slis[i] = lis(a, i, n-1); for(int i = 0; i < n-1; i++) ans = max(ans, plis[i] + slis[i+1]); cout << ans;}int32_t main() { setIO(); solve(); return 0;}

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

glo.cpp:1:25: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h>#define int int64_tusing namespace std;void setIO() {  cin.tie(0)->sync_with_stdio(0);}int lis(vector<int> &a, int i, int j) {  vector<int> seq;  for(int k = i; k < j+1; k++) {    auto it = lower_bound(seq.begin(), seq.end(), a[k]);    if(it == seq.end()) seq.push_back(a[k]);    else *it = a[k];  }  return seq.size();}void solve() {  int n, x, ans = 0;  cin >> n >> x;  vector<int> a(n);  for(auto &e : a) cin >> e;  if(x == 0) { cout << lis(a, 0, n-1); return; }  vector<int> plis(n), slis(n);  for(int i = 0; i < n; i++) plis[i] = lis(a, 0, i);  for(int i = n-1; i > -1; i--) slis[i] = lis(a, i, n-1);  for(int i = 0; i < n-1; i++) ans = max(ans, plis[i] + slis[i+1]);  cout << ans;}int32_t main() {  setIO();  solve();  return 0;}
      |                         ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status