# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443290 | 2021-07-10T09:42:52 Z | BeanZ | Money (IZhO17_money) | C++14 | 0 ms | 204 KB |
// I_Love_LPL 1y0m2d #include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' const int N = 1e5 + 5; long long mod = 1000007; const int lim = 4e5 + 5; const int lg = 20; const int base = 311; const long double eps = 1e-6; ll dp[N][105], a[N]; int main(){ ios_base::sync_with_stdio(false); cin.tie(0); if (fopen("tests.inp", "r")){ freopen("test.inp", "r", stdin); freopen("test.out", "w", stdout); } ll n; cin >> n; set<ll> s; ll nx = -1, ans = 0; for (int i = 1; i <= n; i++){ cin >> a[i]; if (nx < 0 || a[i] < a[i - 1] || a[i] >= nx) { ans++; auto it = s.lower_bound(a[i]); if (it == s.end()) nx = 1e9; nx = *it; } s.insert(a[i]); } cout << ans; } /* 6 3 6 4 5 1 2 Ans: Out: */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |