Submission #515689

# Submission time Handle Problem Language Result Execution time Memory
515689 2022-01-19T13:18:38 Z Be_dos Money (IZhO17_money) C++17
0 / 100
1500 ms 312 KB
#include <iostream>
#include <cmath>
#include <cctype>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <stack>
#include <unordered_set>
#include <sstream>
#include <cstring>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <random>
#include <cfloat>
#include <chrono>
#include <bitset>
#include <complex>
#include <immintrin.h>
#include <cassert>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    int32_t n;
    std::cin >> n;

    int32_t* arr = new int32_t[n];
    for(int32_t i = 0; i < n; i++)
        std::cin >> arr[i];

    std::set<int32_t> already;
    already.insert(n + 1);
    int32_t ans = 0;
    int32_t cur = 0;
    while(cur != n) {
        int32_t bound = *already.lower_bound(arr[cur] + 1);
        ans++;
        bool first = true;
        while(cur < n && arr[cur] <= bound && (first || arr[cur] >= arr[cur - 1])) {
            already.insert(arr[cur]);
            cur++;
            first = false;
        }
    }
    std::cout << ans;
    return 0;
}






# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 312 KB Output is correct
7 Execution timed out 1596 ms 204 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 312 KB Output is correct
7 Execution timed out 1596 ms 204 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 312 KB Output is correct
7 Execution timed out 1596 ms 204 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 312 KB Output is correct
7 Execution timed out 1596 ms 204 KB Time limit exceeded
8 Halted 0 ms 0 KB -