From 0538a8d86986ad79e647bf5ca711611f6754e784 Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Mon, 22 Sep 2025 21:08:46 +0900 Subject: [PATCH] 20250922 baekjoon --- code_study/Baekjoon/ts/1015.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 code_study/Baekjoon/ts/1015.ts diff --git a/code_study/Baekjoon/ts/1015.ts b/code_study/Baekjoon/ts/1015.ts new file mode 100644 index 0000000..e73e092 --- /dev/null +++ b/code_study/Baekjoon/ts/1015.ts @@ -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(' '));