# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1086646 | Wendidiask | Stone Arranging 2 (JOI23_ho_t1) | C++14 | 154 ms | 19796 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
:---:--:--::::::--:-:----:
::-:::. ::-:::
.* -===.. :---
.-+*##=-------====-: :--:
:+##=.* -= :=+- .-=:
.+++-. :- -=. .=+- .--.
.++=- + -= :*- :-.
+*+- :- -=. -*: :=:
#*: * -=. +- .=
=:%+ -: -=. +- --
-%: * -=. *: +.
:%-.. =. -=. # -:
:=# .. + -=. == -=
---+ . = -=. .# .+
-: == . = :------::------:.-=. % .=
:- == .=. ---:. :--#+. .% :-
= .* .+.. :=- :++ -+ =:
+ #. + -=: :*%-*: *
:= :# :=:= . :-----: =+-+ .+
* -* *=- . .- :::::::. :* .#+. +
:- -+ :#. --::-----: :* ++= .-
+ :*. *. .:::::*%: ++ +.-=. +
+ -#**----: .= -*. + -= =
* +.#=+: + . .=+: =. -=. =
= -+ :++: + .. .=+= .= -=. -
= %- :====-:. =. .:--===- * -=. -
+ +-- .:--==#==-:.= + -=. =
* + * =. : .= -=. =
+ = * + = -=. +
:- = .= =: = -=. .-
* + =: * * -=. +
:- .+ =- :- .+ -=. .+
* * := * := -= *
= :- =: .- .=: -=. =:
-: * .=- + .=- -= :-
=: -: --: :- :--: -=. .=
=:+ ----. * :---. -= .+
--=*----------------------=*+=--=+--=+*+------------------------------------------------%+:.
:: := +:- -- :.
.=. =.
-= -=
.=: .=.
.=: .+:
:-- :-:
-- -=.
:--. --:
:--: .--:
.-:-: ::--.
:----. .:----
.:::::::::-::::::--::::::::.
*/
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define int long long
#define debug(x) cerr << #x << " is " << x << "\n"
#define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repb(i, a, b) for (int i = b; i >= a; i--)
#define pii pair<int, int>
#define linebreak cout << "---------------------------------------------------------\n"
#define f first
#define s second
#define pb push_back
#define START auto start = high_resolution_clock::now();
#define END cout << '\n'; auto stop = high_resolution_clock::now(); auto duration = duration_cast<microseconds>(stop - start); long double time = duration.count();cout << "Time taken: " << time/1000000.0 << " seconds" << '\n';
// good luck
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
const int MS = 2e5+5, mod = 1e9+7;
int n, a[MS], cur[MS];
map<int, int> last;
int32_t main() {
cin >> n;
memset(cur, -1, sizeof(cur));
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = n; i >= 1; i--) {
if (last.count(a[i]) == 1) cur[i] = last[a[i]];
last[a[i]] = i;
}
int ind = 1;
while (ind <= n) {
if (cur[ind] == -1) {ind++; continue;}
for (int i = ind; i <= cur[ind]; i++) a[i] = a[ind];
ind = cur[ind];
}
for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |