답안 #540549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
540549 2022-03-20T22:27:45 Z glome Po (COCI21_po) C++17
20 / 70
12 ms 1108 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin >> n;
    vector<int> y(n);
    for (int i = 0; i<n; i++) {
        cin >> y[i];
    }
    vector<int> q;
    q.push_back(-1);
    int ans = -1;
    for (int i = 0; i<n; i++) {
        while(q.back() > y[i]) {
            ans++;
            q.pop_back();
        }
        if(y[i] != q.back()) q.push_back(y[i]);
    }
    cout << ans + q.size() << '\n';
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 4 ms 468 KB Output isn't correct
5 Incorrect 5 ms 596 KB Output isn't correct
6 Correct 10 ms 1108 KB Output is correct
7 Incorrect 12 ms 724 KB Output isn't correct