Submission #486136

#TimeUsernameProblemLanguageResultExecution timeMemory
486136davi_bartPo (COCI21_po)C++14
70 / 70
9 ms1744 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define int ll #define fi first #define se second #define ld long double #define pb push_back mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); signed main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int> v(N); vector<int> k; int ans = 0; for (int &i : v) { cin >> i; while (k.size() && k.back() > i) k.pop_back(); if (i == 0) continue; if (!k.size() || k.back() != i) { ans++; k.pb(i); } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...