結果
| 問題 | No.2740 Old Maid |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-20 16:08:52 |
| 言語 | TypeScript (6.0.2) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 468 bytes |
| 記録 | |
| コンパイル時間 | 4,579 ms |
| コンパイル使用メモリ | 346,304 KB |
| 実行使用メモリ | 161,584 KB |
| 最終ジャッジ日時 | 2026-06-05 06:59:48 |
| 合計ジャッジ時間 | 12,209 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 61 |
ソースコード
declare var require: any;
let lines: string[] = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
let p = lines[1].split(' ').map(Number);
const getMinIndex = (arr: number[]) => arr.reduce((acc, cur, i) => acc.min > i ? {min: i, i} : acc, {min: Infinity, i: -1});
const q = [];
while(p.length > 0) {
const mins = getMinIndex(p.slice(0, -1));
q.push(p[mins.i], p[mins.i+1]);
p = p.slice(0, mins.i).concat(p.slice(mins.i+2));
}
console.log(q.join(' '))