Submission

Status:

PP-PPPPPP-

Subtask/Task Score:

80/100

Score: 80

User: theem1502

Problemset: Maximum Adjacent

Language: cpp

Time: 0.003 second

Submitted On: 2026-02-27 22:57:51

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

int main() {
    vector<long long> thearray;
    long long num = 0;
    long long a;
    while(cin >> a) {
        thearray.push_back(a);
        num++;

    }
    num--;
    for (long long i = 0; i < num; i++) {
     //   cout << thearray[i];
    }
    vector<long long> ansarray;
    for (long long i = 0; i < num; i++) {
        if (i == 0) {
            if (thearray[i+1] < thearray[i]) ansarray.push_back(thearray[i]);

        }
        else if (i == num - 1) {
            if (thearray[i-1] < thearray[i]) ansarray.push_back(thearray[i]);
        }
        else {
            if (thearray[i-1] < thearray[i] && thearray[i+1] < thearray[i]) ansarray.push_back(thearray[i]);

        }

    }
    for (auto x: ansarray) cout << x << " ";

}