답안 #710120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710120 2023-03-15T04:53:57 Z Tyx2019 Money (IZhO17_money) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
main(){
    int N;
    cin >> N;
    int A[N];
    for(int i=0;i<N;i++) cin >> A[i];
    multiset<int> S;
    queue<int> Q;
    int prev=-1;
    int cnt=1;
    int lessthan=INT_MAX;
    for(int i=0;i<N;i++){
        if(prev==-1){
            prev=A[i];
            auto k=S.upper_bound(A[i]);
            if(k!=S.end()){
                lessthan=*k;
            }
            Q.push(A[i]);
            continue;
        }
        if(A[i]>=A[i-1]&&A[i]<=lessthan){
            Q.push(A[i]);
            continue;
        }
        prev=-1;
        cnt++;
        i--;
        while(!Q.empty()){
            S.insert(Q.front());
            Q.pop();
        }
        leq=INT_MAX;
    }
    cout << cnt;
}

Compilation message

money.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
money.cpp: In function 'int main()':
money.cpp:35:9: error: 'leq' was not declared in this scope
   35 |         leq=INT_MAX;
      |         ^~~