# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
36054 | 2017-12-05T01:50:43 Z | UncleGrandpa925 | Money (IZhO17_money) | C++14 | 0 ms | 2180 KB |
/*input 6 3 6 4 5 1 2 */ #include <bits/stdc++.h> using namespace std; #define sp ' ' #define endl '\n' #define fi first #define se second #define mp make_pair #define int long long #define N #define bit(x,y) ((x>>y)&1LL) #define na(x) (#x) << ":" << x ostream& operator << (ostream &os, vector<int>&x) { for (int i = 0; i < x.size(); i++) os << x[i] << sp; return os; } ostream& operator << (ostream &os, pair<int, int> x) { cout << x.fi << sp << x.se << sp; return os; } ostream& operator << (ostream &os, vector<pair<int, int> >&x) { for (int i = 0; i < x.size(); i++) os << x[i] << endl; return os; } int n; vector<int> a; set<int> st; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= n; i++) { int t; cin >> t; a.push_back(t); } int last = a.front(), ans = 0; int mx = 1e9; st.insert(a.front()); for (int i = 1; i < a.size(); i++) { if (a[i] < last) { ans++; auto it = st.lower_bound(a[i]); if (it == st.end()) mx = 1e9; else mx = *it; } else if (a[i] > mx) { ans++; auto it = st.lower_bound(a[i]); if (it == st.end()) mx = 1e9; else mx = *it; } last = a[i]; st.insert(a[i]); } ans++; cout << ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2180 KB | Output is correct |
2 | Correct | 0 ms | 2180 KB | Output is correct |
3 | Correct | 0 ms | 2180 KB | Output is correct |
4 | Incorrect | 0 ms | 2180 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |