Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: theem1502
Problemset: Maximum Adjacent
Language: cpp
Time: 0.002 second
Submitted On: 2026-02-27 23:01:34
#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++;
}
/*
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])/*, cout << "yes"*/;
}
else {
if (thearray[i-1] < thearray[i] && thearray[i+1] < thearray[i]) ansarray.push_back(thearray[i]);
}
}
for (auto x: ansarray) cout << x << " ";
}