Submission
Status:
PPPPPPPPPP
Score: 100
User: Nakornrat
Problemset: Maximum Adjacent
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-23 10:36:14
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int main()
{
ios::sync_with_stdio(false);cin.tie(0);
int n;
vector<int> a;
while(cin>>n){
a.push_back(n);
}
vector<int>ans;
int sz = a.size();
for(int i=0;i<sz;i++){
bool check = 1;
if(i>0){
if(a[i]<=a[i-1])check = 0;
}
if(i<sz-1){
if(a[i]<=a[i+1])check = 0;
}
if(check){
ans.push_back(a[i]);
}
}
for(int x:ans)cout<<x<<' ';
}