Submission #977153

#TimeUsernameProblemLanguageResultExecution timeMemory
977153IsamMoney (IZhO17_money)C++17
0 / 100
0 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define eb emplace_back constexpr int sz = 1e6 + 6; constexpr int inf = (int)1E9 + 7; int n, a[sz], ans; vector<pair<vector<int>, pair<int, int>>> vos; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); cin >> n; for(register int i = 1; i <= n; ++i){ cin >> a[i]; } int l(1); a[n+1] = -inf; for(register int i = 1; i <= n + 1; ++i){ if(a[i] < a[i-1]){ vector<int> opi; for(register int j = l; j < i; ++j){ opi.eb(a[j]); } vos.eb((pair<vector<int>, pair<int, int>>){opi, {l, i-1}}); ++ans; l = i; } } // for(auto to : vos){ // // for(auto too : to) cerr << too << ' '; // cout << '\n'; // } for(auto to : vos){ pair<int, int> ro = to.second; int l = ro.first, r = ro.second; int lo = a[l], hi = a[r]; for(register int i = 1; i < l; ++i){ if(a[i] >= lo && a[i] <= hi){ lo = a[i]; ++ans; } } } cout << ans << '\n'; }

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:17:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |  for(register int i = 1; i <= n; ++i){
      |                   ^
money.cpp:25:19: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 |  for(register int i = 1; i <= n + 1; ++i){
      |                   ^
money.cpp:31:21: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |    for(register int j = l; j < i; ++j){
      |                     ^
money.cpp:58:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   58 |   for(register int i = 1; i < l; ++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...