結果
| 問題 | No.14 最小公倍数ソート |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-16 03:53:02 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 568 bytes |
| 記録 | |
| コンパイル時間 | 2,822 ms |
| コンパイル使用メモリ | 191,480 KB |
| 実行使用メモリ | 9,716 KB |
| 最終ジャッジ日時 | 2026-10-16 03:53:15 |
| 合計ジャッジ時間 | 13,240 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 TLE * 1 -- * 15 |
ソースコード
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
int main() {
using namespace std;
int n;
cin >> n;
vector<int> a(n);
for (auto &e : a) { cin >> e; }
for (int i = 0; i < n; i++) {
sort(a.begin() + i + 1, a.end(), [&](const int x, const int y) {
int lx = lcm(x, a[i]), ly = lcm(y, a[i]);
if (lx != ly) {
return lx < ly;
} else {
return x < y;
}
});
}
for (auto e : a) { cout << e << " "; }
cout << endl;
}