Submission #976985

#TimeUsernameProblemLanguageResultExecution timeMemory
976985IsamMoney (IZhO17_money)C++17
0 / 100
1 ms468 KiB
#include<bits/stdc++.h> using namespace std; #define eb emplace_back constexpr int sz = 1e6 + 6; int n, a[sz], ans; set<int> st; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for(register int i = 1; i <= n; ++i){ cin >> a[i]; } st.insert((int)1E9 + 7); st.insert(a[1]); for(register int i = 2; i <= n; ++i){ if(a[i] < a[i-1]){ ++ans; }else{ auto it = st.lower_bound(a[i-1] + 1); if(*it <= a[i]) ++ans; } st.insert(a[i]); } cout << ans + 1 << '\n'; }

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:15:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   15 |  for(register int i = 1; i <= n; ++i){
      |                   ^
money.cpp:23:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   23 |  for(register int i = 2; i <= n; ++i){
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...