20250922 baekjoon

This commit is contained in:
songyc macbook 2025-09-22 21:08:46 +09:00
parent 70f8b0eeff
commit 0538a8d869

View 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(' '));