제출 #870047

#제출 시각아이디문제언어결과실행 시간메모리
870047Maite_MoraleStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
336 ms37680 KiB
#include<bits/stdc++.h> #define F first #define S second #define MAX 500005 #define oo 1e18 #define mod 1000000007 #define fast_in ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(0); using namespace std; typedef long long ll; #define pll pair<ll , ll> #define vll vector<ll> #define vvll vector<vll> #define vpll vector<pll> ll n,a[MAX]; map<ll,ll> mp; vll v[MAX]; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; if(mp[a[i]]==0)mp[a[i]]=i; v[mp[a[i]]].push_back(i); } for(int i=1;i<=n;i++){ for(int j=i;j<=v[mp[a[i]]].back();j++){ cout<<a[i]<<"\n"; }i=v[mp[a[i]]].back(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...