Submission #1135708

#TimeUsernameProblemLanguageResultExecution timeMemory
1135708TAFHMoney (IZhO17_money)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #pragma GCC optimize ("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; // using namespace __gnu_pbds; #define forn(i, n) for (int i = 0; i < n; i++) #define ull unsigned long long #define ll long long #define int long long #define SPEED \ ios_base::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0) // typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const int N = 4e5 + 13; const int maxa = 2e5 + 13; const ll mod = 998244353; const int mxn = 1e6 + 13; const int mxa = 1e6 + 13; void prestart() {} void start() { int n; cin >> n; int a[n]; forn(i, n) cin >> a[i]; int ans = 0; set<int> s; for(int i = 0; i < n; i++) { auto ptr1 = s.upper_bound(a[i]); int j = i + 1; while(j < n && a[j - 1] <= a[j] && (ptr1 == s.end() || a[j] <= (*ptr1))) { j++; } i = j - 1; ans++; } cout << ans << "\n"; } signed main() { SPEED; int t = 1; prestart(); // cin >> t; while (t--) { start(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...