답안 #686612

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
686612 2023-01-25T14:56:17 Z toma_ariciu Money (IZhO17_money) C++17
0 / 100
1 ms 308 KB
/// banii banii banii
/// 2 locuri in masina ca milionarii
#include <iostream>
#include <set>

using namespace std;

int n, v[1000005], ans = 1;
set <int> values;

int solve(int poz)
{
    auto it = values.upper_bound(v[poz]);
    int aux;
    for(aux = poz + 1; aux <= n; aux++)
    {
        if(v[aux] < v[aux - 1])
            break;
        auto it2 = values.upper_bound(v[aux]);
        if(it != it2)
            break;
    }
    for(int i = poz; i < aux; i++)
        values.insert(v[i]);
    return aux;
}

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    int poz = 0;
    for(int i = 2; i <= n && !poz; i++)
        if(v[i] < v[i - 1])
            poz = i;
    for(int i = 1; i < poz; i++)
        values.insert(v[i]);
    while(poz <= n)
    {
        poz = solve(poz);
        ans++;
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -