Submission

Status:

----------

Subtask/Task Score:

0/100

Score: 0

User: Test

Problemset: Consecutive Subsequence

Language: cpp

Time: 0.003 second

Submitted On: 2026-03-17 22:52:48


#include <bits/stdc++.h>
using namespace std;

int main(){
    int ck=0;
    vector<int> v;
    int sz=0;
    int x;
    while(cin >> x){
        sz++;
        v.push_back(x);
    }
    if(sz == 0) return 0;

    if(sz == 1){
        cout << v[0];
        return 0;
    }
    if(v[1]<v[0]) cout << v[0] << " ";
    for(int i=1;i<sz-1;i++){
        if(v[i+1]<v[i] && v[i-1]<v[i]){
            cout << v[i] << " ";
        }
    }
    if(v[sz-1]>v[sz-2]) cout << v[sz-1] << " ";

}