Submission #898529

#TimeUsernameProblemLanguageResultExecution timeMemory
898529vjudge1Po (COCI21_po)C++17
70 / 70
36 ms1572 KiB
#include<bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; stack<int> s; for(int i = 0; i < n; i++) { int x; cin >> x; while(s.size()&&s.top()>x) s.pop(); if(s.size()&&s.top()==x) continue; if(x) ans++,s.push(x); } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...