이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define Add_Speed ios_base::sync_with_stdio(0);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define f first
#define sz size()
#define s second
#define all(s) s.begin(), s.end()
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define inf INT_MAX
                                                                                                                                            
using namespace std;
const int maxn = (int)1e6 + 100;
const int maxM = (int)1e3 + 100;
const int mod = (int)1e9 + 7;
const int maxlog = (int)20;
const int P = mod;                  
int n, a[maxn], ans;
set<int> s;
main () {
  Add_Speed
  cin >> n;
  for(int i = 1; i <= n; i++)
    cin >> a[i];
  s.insert(-1);
  s.insert(inf);
  int i = 1;
  while(i <= n){
    ans++;
    int j = i;
    int x = *s.upper_bound(a[i]);
    while(j + 1 <= n && a[j + 1] >= a[j] && a[j + 1] <= x){
      j++;
    }
    for(int k = i; k <= j; k++)
      s.insert(a[k]);
    i = j + 1;
  } 
  cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
money.cpp:25:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |