結果
問題 | No.326 あみだますたー |
ユーザー | AreTrash |
提出日時 | 2016-05-02 13:23:25 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,223 bytes |
コンパイル時間 | 1,183 ms |
コンパイル使用メモリ | 106,624 KB |
実行使用メモリ | 27,224 KB |
最終ジャッジ日時 | 2024-04-15 09:11:14 |
合計ジャッジ時間 | 5,631 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
25,264 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 29 ms
25,156 KB |
testcase_06 | AC | 33 ms
25,164 KB |
testcase_07 | AC | 31 ms
26,816 KB |
testcase_08 | AC | 44 ms
27,004 KB |
testcase_09 | AC | 45 ms
25,032 KB |
testcase_10 | AC | 46 ms
25,160 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 | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; namespace No326_1{ public class Program{ public static void Main(string[] args){ var n = int.Parse(Console.ReadLine()); var k = int.Parse(Console.ReadLine()); var seq = Enumerable.Range(1, n).ToArray(); for(var i = 0; i < k; i++){ var x = int.Parse(Console.ReadLine().Split(' ')[0]); var tmp = seq[x]; seq[x] = seq[x - 1]; seq[x - 1] = tmp; } var goal = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse); var resultList = new List<int>(); for(var i = 1; i < n; i++){ for(var j = 1; j < n - i + 1; j++){ if(Array.IndexOf(goal, seq[j]) < Array.IndexOf(goal, seq[j - 1])){ var tmp = seq[j]; seq[j] = seq[j - 1]; seq[j - 1] = tmp; resultList.Add(j); } } } Console.WriteLine(resultList.Count); resultList.ForEach(i => Console.WriteLine($"{i} {i + 1}")); } } }