# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
229869 | 2020-05-06T22:16:20 Z | pedroslrey | Money (IZhO17_money) | C++14 | 5 ms | 256 KB |
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using lli = long long int; #define debug(args...) fprintf(stderr, args) #define pb push_back #define fi first #define se second #define all(xs) xs.begin(), xs.end() const int INF = 1e9; vector<int> xs; vector<int> ys; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { int x; scanf("%d", &x); xs.pb(x); } ys.push_back(xs[0]); for (int i = 1; i < n; ++i) if (xs[i] != xs[i-1]) ys.push_back(xs[i]); int m = (int)ys.size(); set<int> s; s.insert(INF); int total = 0; int k = 0; for (int i = 0; i < m-1; ++i) { if ((ys[i] > ys[i+1]) || (ys[i] < ys[i+1] && *s.lower_bound(ys[i]-k+1) < ys[i+1])){ k = 0; ++total; } else k = 1; s.insert(ys[i]); } printf("%d\n", total); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |