結果
| 問題 | No.3489 あみだくじ作り |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-03 22:26:29 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 444 bytes |
| 記録 | |
| コンパイル時間 | 2,084 ms |
| コンパイル使用メモリ | 334,220 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-03 22:26:44 |
| 合計ジャッジ時間 | 4,389 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n), ans;
for(auto &&v : a) cin >> v;
for(int i = 0; i < n; i++){
for(int j = 1; j < n; j++){
if(a[j - 1] > a[j]){
swap(a[j - 1], a[j]);
ans.emplace_back(j);
}
}
}
reverse(ans.begin(), ans.end());
cout << "Yes\n";
cout << ans.size() << '\n';
for(auto &&v : ans) cout << v << '\n';
}