답안 #587865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
587865 2022-07-02T12:32:02 Z MasterTaster Money (IZhO17_money) C++14
0 / 100
1 ms 212 KB
#include <iostream>
#include<set>

#define MAXN 1000010

using namespace std;

int n, a[MAXN], ress;

int main() {
    cin>>n;
    for (int i=0; i<n; i++) cin>>a[i];

    set<int> s;
    int i=0;
    while (i<n)
    {
        auto it=s.upper_bound(a[i]);
        bool nema=0; int br;
        if (it==s.end()) nema=1;
        else br=*it;

        i++;
        while (i<n && (i==0 || a[i]>=a[i-1]) && (nema || a[i]<=br)) { s.insert(a[i]); i++; }

        //cout<<i<<endl;
        ress++;
    }
    cout<<ress;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -