Submission #710122

#TimeUsernameProblemLanguageResultExecution timeMemory
710122WH8Money (IZhO17_money)C++14
100 / 100
1299 ms55208 KiB
#include <bits/stdc++.h> using namespace std; #define iloop(x, n) for (long long i = x; i < n; ++i) #define jloop(x, n) for (long long j = x; j < n; ++j) #define kloop(x, n) for (long long k = x; k < n; ++k) #define dloop(x, n) for (long long d = x; d >= n; --d) #define ll long long #define pll pair<long long, long long> #define pii pair<int, int> #define vi vector<long long> #define mp make_pair #define pb push_back #define f first #define s second #define int long long #define endl '\n' #define debug(x) cout << #x << ": " << x << endl #define FASTIO \ ios::sync_with_stdio(false); \ cin.tie(0); \ cout.tie(0); signed main(){ int n; cin >> n; vi v(n); iloop(0, n) cin >> v[i]; set<int> s; int i = 0; int cnt = 0; while (i < n){ auto it = s.upper_bound(v[i]); s.insert(v[i]); while (i + 1 < n and v[i+1] >= v[i] and (it == s.end() or v[i+1] <= *it)){ i++; s.insert(v[i]); } i++; cnt++; } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...