제출 #782321

#제출 시각아이디문제언어결과실행 시간메모리
782321AndreyStone Arranging 2 (JOI23_ho_t1)C++14
35 / 100
21 ms2684 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,a,c,b; cin >> n; map<int,int> haha; vector<int> bruh(n); vector<int> ans(n); for(int i = 0; i < n; i++) { cin >> a; if(haha.find(a) == haha.end()) { haha[a] = i; } bruh[i] = a; } c = bruh[n-1]; for(int i = n-1; i >= 0; i--) { b = bruh[i]; if(haha[c] > haha[b]) { c = b; } ans[i] = c; } for(int i = 0; i < n; i++) { cout << ans[i] << " "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...