제출 #1022951

#제출 시각아이디문제언어결과실행 시간메모리
1022951ag_1204Stone Arranging 2 (JOI23_ho_t1)C++17
25 / 100
2069 ms2804 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define pb push_back
 
int32_t main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tt=1; //cin>>tt;
	while(tt--) {
	    int n; cin>>n;
        deque<int> v;
        for(int i=0; i<n; i++) {
            int x; cin >> x;
            auto it = find(v.begin(), v.end(), x);
            if (it != v.end()) {
                for (int j=0; j<it-v.begin(); j++) {
                    v[j] = x;
                }
            }
            v.push_front(x);
        }
        for(int i=n-1; i>=0; i--) cout << v[i] << "\n";
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...