답안 #367101

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
367101 2021-02-16T09:49:22 Z ritul_kr_singh Po (COCI21_po) C++17
10 / 70
12 ms 1516 KB
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp << " " <<
#define nl << "\n"

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n; cin >> n;
    int a[n], ans = 1;
    for(int& i : a) cin >> i;

    stack<int> s;
    s.push(a[0]);

    for(int i=1; i<n; ++i){
        ans += !s.empty() and s.top() < a[i];
        while(!s.empty() and s.top() >= a[i]) s.pop();
        s.push(a[i]);
    }
    cout << ans nl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 384 KB Output isn't correct
4 Incorrect 5 ms 748 KB Output isn't correct
5 Incorrect 7 ms 876 KB Output isn't correct
6 Correct 12 ms 1516 KB Output is correct
7 Incorrect 12 ms 1132 KB Output isn't correct