Submission #857337

#TimeUsernameProblemLanguageResultExecution timeMemory
857337MarceantasyStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
169 ms14712 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array #define rep(i, n) for(int i = 0; i<(int)n; ++i) const int mxN = 2e5+5, MOD = 998244353; map<int, vector<int>> mp; void solve(){ int n; cin >> n; vector<int> a(n),ans(n); for(auto &inp : a) cin >> inp; map < int , int > ind; for(int i = 0;i<n;i++)ind[a[i]] = i; for(int i = 0;i<n;i++){ for(int j = i;j<=ind[a[i]];j++){ ans[j] = a[i]; } i = ind[a[i]]; } for(auto itr : ans)cout << itr << '\n'; } int main(){ #ifdef _DEBUG // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...