# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
366071 | 2021-02-13T01:26:29 Z | mahmoudbadawy | Money (IZhO17_money) | C++17 | 1 ms | 364 KB |
#include <bits/stdc++.h> using namespace std; const int N=1e6+6; set<int> ss; vector<int> v; int n; int arr[N]; int main() { scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d",&arr[i]); ss.insert((1<<30)); v.push_back(arr[0]); int ans=1; for(int i=1;i<n;i++) { if(arr[i]<v.back() || *ss.upper_bound(arr[i])!=*ss.upper_bound(v.back())) { //cout << arr[i] << " " << v.back() << " " << (*ss.lower_bound(arr[i])) << " " << (*ss.lower_bound(v.back())) << endl; for(int j:v) ss.insert(j); ans++; v.clear(); } v.push_back(arr[i]); } printf("%d\n",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Incorrect | 0 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Incorrect | 0 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Incorrect | 0 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Incorrect | 0 ms | 364 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |