# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
758292 | 2023-06-14T12:06:29 Z | vjudge1 | Money (IZhO17_money) | C++17 | 1 ms | 212 KB |
#include <bits/stdc++.h> #include <array> #define setall(a, val) for(auto& x : a) x = val #define all(v) (v.begin()), (v.end()) #define cerr (cerr << "D: ") #define ll long long using namespace std; clock_t start_time; double get_time() { return (double)(clock() - start_time) / CLOCKS_PER_SEC; } void init(bool oj = 0) { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); start_time = clock(); if (!oj) { #ifndef ONLINE_JUDGE FILE* _ = freopen("in.txt", "r", stdin); //FILE* __ = freopen("out.txt", "w", stdout); #endif } } const ll HASH_BASE = 31; const ll MOD = 2000000011; const ll N = 1e6 + 7; const ll M = 1e7 + 1e7 / 2; //#################################################################################### int main() { init(1); int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int ans = 1; set<int> s = { v[0] }; for (int i = 1; i < n; i++) { int x = s.upper_bound(v[i - 1]) != s.end() ? *s.upper_bound(v[i - 1]) : v[i]; if (v[i] >= v[i - 1] && x >= v[i]) s.insert(v[i]); else ans++; } cout << ans << endl; cerr << get_time() << "s" << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Incorrect | 1 ms | 212 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |