#include <bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(false); cin.tie(nullptr);
#define s(x) x.size()
#define sort(x) sort(x.begin(),x.end())
#define rsort(x) sort(x.rbegin(),x.rend())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second
#define INF 1e9
#define INFL 1e18
using ll = long long;
using pii = pair<int, int>;
void solve() {
int n; cin >> n;
vector<int> v(n);
//map<int,priority_queue<int>>kolejka;
map<int,int>maksymalne;
for (int i = 0; i < n; ++i){
cin >> v[i];
//kolejka[v[i]].push(i);
maksymalne[v[i]]=i;
}
for (int i = 0; i < n; i++) {
int wartosc = maksymalne[v[i]];
//cout << "wartosc: " << wartosc << endl;
for (int j = i; j <= wartosc; j++) {
cout << v[i] << '\n';
// cout << "maks: " << maksymalne[v[i]] << endl;
//i=j;
}
i = wartosc;
}
}
int main() {
fastio;
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |