20250922 baekjoon
This commit is contained in:
parent
70f8b0eeff
commit
0538a8d869
15
code_study/Baekjoon/ts/1015.ts
Normal file
15
code_study/Baekjoon/ts/1015.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
export {};
|
||||||
|
|
||||||
|
const input: string[] = require("fs").readFileSync(0).toString().trim().split('\n');
|
||||||
|
const N: number = Number(input[0]);
|
||||||
|
const A: number[] = input[1].split(' ').map(Number);
|
||||||
|
|
||||||
|
const sortedA: number[] = A.slice(0).sort((a,b) => a-b);
|
||||||
|
const P: number[] = new Array(N).fill(-1);
|
||||||
|
A.forEach((v,i) => {
|
||||||
|
P[i] = sortedA.findIndex((val, idx) =>{
|
||||||
|
if (val===v && !(P.includes(idx))) return true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(P.join(' '));
|
||||||
Loading…
x
Reference in New Issue
Block a user