Submission
Status:
PP-PPPPPP-
Score: 80
User: Dormon
Problemset: Maximum Adjacent
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-14 14:18:03
#include <iostream>
#include <cstdint>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <numeric>
#include <array>
#include <iomanip> // cout << fixed << setprecision(n);
using namespace std;
const bool TEST_CASE = 0;
template<typename T>
typename std::enable_if<std::is_integral<T>::value>::type
Debug(const char* name, T value) {
std::cout << name << " : " << value << '\n';
}
template<typename T, typename... Args>
typename std::enable_if<std::is_integral<T>::value>::type
Debug(const char* names, T value, Args... args){
const char* comma = strchr(names, ',');
std::cout.write(names, comma - names) << " : " << value << " | ";
Debug(comma + 1, args...);
}
template<typename T>
ostream& operator<<(ostream& out, vector<T> &a){
for (auto &x : a) out << x << ' ';
return out;
};
#ifdef DORMON
#define debug(...) Debug(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...)
#endif
void solve(){
int x;
vector<int> v;
v.push_back(-2e9);
while (cin >> x)
v.push_back(x);
v.pop_back();
v.push_back(-2e9);
int n = v.size();
for (int i = 1;i <= n;i++)
if (v[i] > v[i - 1] && v[i] > v[i + 1])
cout << v[i] << ' ';
cout << '\n';
}
int main()
{
#ifndef DORMON
ios_base::sync_with_stdio(false);
#endif
cin.tie(0);
int q = 1;
if (TEST_CASE) cin >> q;
while (q--){
solve();
}
}