Submission #1111318

#TimeUsernameProblemLanguageResultExecution timeMemory
1111318FlandreStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
203 ms14408 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

// loal is the cutest girl

#define ll long long
#define ld long double
#define pow2(x) (x)*(x)
#define le left
#define ri right
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(), v.end()
#define pii pair<int, int>
#define pll pair<long long, long long>
#define isvowel(x) (x) == 'a' || (x) == 'i' || (x) == 'u' || (x) == 'e' || (x) == 'o'
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const ld EPS = 1e-9;
const ld PI = 3.141592653589793238462643383279502884197169399375105820974944;

signed main() {
  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  
  int n;
  cin >> n;
  int a[n];
  map<int, int> mx;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx[a[i]] = i;
  }

  int i = 0;
  while (i < n) {
    int curr = a[i];
    for (; i < mx[curr]+1; i++) {
      a[i] = curr;
    }
  }

  for (auto i : a) cout << i << '\n';
  
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...