結果
| 問題 | No.3489 あみだくじ作り |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-03 21:26:30 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 486 bytes |
| 記録 | |
| コンパイル時間 | 1,709 ms |
| コンパイル使用メモリ | 212,636 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-03 21:26:37 |
| 合計ジャッジ時間 | 2,644 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge1_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<int> P(N);
for(auto &p : P) cin >> p,p--;
vector<int> answer;
for(int i=0; i<N; i++){
for(int k=0; k<N-1; k++){
if(P.at(k) > P.at(k+1)) answer.push_back(k),swap(P.at(k),P.at(k+1));
}
}
cout << "Yes\n";
cout << answer.size() << "\n";
for(auto a : answer) cout << a+1 << "\n";
}