# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
671795 |
2022-12-14T02:08:26 Z |
Cutebol |
Money (IZhO17_money) |
C++17 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
//void fopn(string name){freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout);}
#define Scaramouche ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0);
#define int long long
#define itn int
#define endl "\n"
#define ff first
#define ss second
const int N = 1e6 + 5 ;
const int mod = 1e9 + 7 ;
const int inf = 1e7 ;
int n , cnt = 1 , last ;
int a[N] ;
void solve(){
cin >> n ;
for ( int i = 0 ; i < n ; i ++ ) cin >> a[i] ;
multiset <int> cur ;
cur.insert(a[0]) ;
last = a[0] ;
for ( int i = 1 ; i < n ; i ++ ){
auto it1 = cur.lower_bound(a[i]) ;
auto it2 = cur.upper_bound(last) ;
if ( a[i] < last || ( it1 != it2 && it1 != cur.end() && a[i] != last ) ){
cnt ++ ;
}
cur.insert(a[i]) ;
last = a[i] ;
}
cout << cnt ;
}
signed main(){
// fopn("talent") ;
Scaramouche ;
int t = 1 ;
// cin >> t ;
while ( t -- ) solve() ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |