# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
492191 |
2021-12-05T21:11:02 Z |
White |
Money (IZhO17_money) |
C++14 |
|
0 ms |
204 KB |
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int num[1000001];
set<int>a;
int main (){
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
int n,br=0;
cin>>n;
for(int i=1;i<=n;i++)cin>>num[i];
a.insert(0);a.insert(1000002);
for(int i=1;i<=n;){
int j=0;
//cout<<"daw"<<endl;
set<int>::iterator it = a.lower_bound(num[i]);
int go;
if (it != a.begin()) {
it--;
}
it=a.upper_bound(*it);
go=*it;
//cout<<go<<endl;
a.insert(num[i]);
br++;
i++;
while(i<=n && num[i-1]<=num[i] && num[i]<=go){
j++;
a.insert(num[i]);
i++;
}
}
cout<<br<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |