結果
問題 | No.326 あみだますたー |
ユーザー | alpha_virginis |
提出日時 | 2015-12-26 17:08:35 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 649 bytes |
コンパイル時間 | 1,351 ms |
コンパイル使用メモリ | 162,588 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-19 04:06:31 |
合計ジャッジ時間 | 5,739 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 5 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,348 KB |
testcase_06 | WA | - |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 9 ms
4,348 KB |
testcase_09 | WA | - |
testcase_10 | AC | 10 ms
4,348 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
ソースコード
#include <bits/stdc++.h> int main() { int N, K; int t; int A[128]; std::cin >> N >> K; for(int i = 0; i < K; ++i) std::cin >> t >> t; for(int i = 1; i <= N; ++i) { std::cin >> A[i]; } std::vector<int> res; for(int i = 1; i <= N; ++i) { int n = 0; for(int j = 1; j <= N; ++j) { if( A[j] == i ) { n = j; break; } } for(int j = n - 1; j >= i; --j) { res.push_back(j); std::swap(A[j], A[j+1]); } } std::cout << res.size() << std::endl; for(int i = 0; i < (int)res.size(); ++i) { std::cout << res[i] << ' ' << res[i] + 1 << std::endl; } return 0; }