Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: meme_boi2

Problemset: Maximum Adjacent

Language: cpp

Time: 0.002 second

Submitted On: 2025-11-02 20:40:31

#include <bits/stdc++.h>
using namespace std;
int32_t main(){
    cin.tie(nullptr)->sync_with_stdio(0);
    vector<int> mat = {0};
    while(1){
        string txt;
        cin >> txt;
        if(isalpha(txt[0])){
            break;
        }else mat.push_back(stoi(txt));
    }
    mat.push_back(0);
   // int l = 0, r = 0,ll = 0,rr = 0, n = mat.size();
   // sort(mat.begin(),mat.end());
   // mat.erase(unique(mat.begin(),mat.end()),mat.end());
    // n = mat.size();
  //  for(r = 1; r < n; r++){
  //      if(mat[r]-mat[r-1] == 1){
 //           //cout << l << ' ' << r << '\n';
  //          if(r-l > rr-ll){
   //             rr = r;
  //              ll = l;
  //          }
  //      }else{
   //         l = r;
  //      }
   // }
   // for(int i = 0; i < n; i++) cout << mat[i] << ' ';
    //cout << ll << ' ' << rr << '\n';
    for(int i = 1; i <= mat.size(); i++){
        if(mat[i] > mat[i-1] && mat[i] > mat[i+1]) cout << mat[i] << ' ';
    }
}