# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
135235 |
2019-07-23T21:10:14 Z |
FedericoS |
Money (IZhO17_money) |
C++14 |
|
3 ms |
504 KB |
#include <iostream>
#include <set>
#include <algorithm>
#include <assert.h>
using namespace std;
int N;
int A[1000006];
int B[1000006];
set<int> S;
int ans;
int main(){
cin>>N;
for(int i=0;i<N;i++){
cin>>A[i];
B[i]=A[i];
}
S.insert(N+1);
sort(B,B+N);
for(int i=0;i<N;i++)
assert(B[i]==i+1);
for(int i=0;i<N-1;i++){
if((A[i]>A[i+1]) or (A[i]<A[i+1] and (*S.lower_bound(A[i]))<A[i+1]))
ans++;
S.insert(A[i]);
}
cout<<ans+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Halted |
0 ms |
0 KB |
- |