Submission #533260

#TimeUsernameProblemLanguageResultExecution timeMemory
533260devariaotaMoney (IZhO17_money)C++17
100 / 100
837 ms61868 KiB
#include <bits/stdc++.h> using namespace std; #define nyahalo ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define otsumiko exit(0); #define mikodanye priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<long long, long long> > > #define mikochi priority_queue<long long, vector<long long>, greater<long long> > int main() { nyahalo long long n; cin >> n; long long ans = 0, a[n+1], pv, ab, l, r, val; set<long long> st; for (long long i=1; i<=n; i++) { cin >> a[i]; } l = 1; while (l<=n) { ans++; r = l+1; if (l == 1) { val = 1e9; } else { auto it = st.upper_bound(a[l]); if (it == st.end()) { val = 1e9; } else { val = *it; } } st.insert(a[l]); while (r<=n) { if (a[r]>val || a[r]<a[r-1]) { break; } st.insert(a[r]); r++; } l = r; } cout << ans << "\n"; otsumiko }

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:13:30: warning: unused variable 'pv' [-Wunused-variable]
   13 |   long long ans = 0, a[n+1], pv, ab, l, r, val;
      |                              ^~
money.cpp:13:34: warning: unused variable 'ab' [-Wunused-variable]
   13 |   long long ans = 0, a[n+1], pv, ab, l, r, val;
      |                                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...