Submission #910859

#TimeUsernameProblemLanguageResultExecution timeMemory
910859vjudge1Money (IZhO17_money)C++17
100 / 100
1409 ms59960 KiB
/* (( '-""``""-' )) )-__-_.._-__-( / --- (o _ o) --- \ \ .-* ( .0. ) *-. / _'-. ,_ '=' _, .-'_ / ;#'#'# - #'#'#; \ \_)) -----'#'----- ((_/ # --------- # '# ------- #' /..-'# ------- #'-.\ _\...-\'# -- #'/-.../_ ((____)- '#' -(____)) art by - Vinni01 / luchi abi cout << fixed << setprecision(6) << x; freopen ( "sum.in", "r", stdin ) */ #include <map> #include <set> #include <list> #include <cmath> #include <ctime> #include <deque> #include <queue> #include <stack> #include <string> #include <bitset> #include <cstdio> #include <limits> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <fstream> #include <numeric> #include <sstream> #include <cassert> #include <iomanip> #include <iostream> #include <algorithm> #include <stdio.h> #include <fstream> #include <unordered_map> using namespace std ; #define ll int #define dd double #define ff first #define ss second #define pb push_back #define pf push_front #define UseOFF ios_base::sync_with_stdio(0);cin.tie(0), cout.tie(0); #define sz size #define ins insert #define new jweijofdg const ll N = 1e6 + 111; ll tt = 1 ; ll a[ N ], b[ N ] ; set < ll > st ; ll num = 0 ; void solve() { ll n ; cin >> n ; st.ins( 1e9 ) ; for( int i = 1 ; i <= n ; i++ ) { cin >> a[ i ] ; } ll ans = 0 ; for( int i = 1 ; i <= n ; i++ ) { st.ins( a[ i ] ) ; ll mx = *st.upper_bound( a[ i ] ) ; while(i + 1 <= n && a[ i ] <= a[ i + 1 ] && a[ i + 1 ] <= mx ) { st.ins( a[ i + 1 ] ) ; i++ ; } ans++ ; } cout << ans ; } signed main() { UseOFF //cin >> tt ; while( tt-- ) { solve() ; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...