結果
問題 |
No.482 あなたの名は
|
ユーザー |
|
提出日時 | 2017-03-21 19:47:43 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,322 bytes |
コンパイル時間 | 3,703 ms |
コンパイル使用メモリ | 102,912 KB |
実行使用メモリ | 41,088 KB |
最終ジャッジ日時 | 2024-07-05 06:08:29 |
合計ジャッジ時間 | 8,299 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 2 TLE * 1 -- * 15 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace yukicoder { class Program { static void Main(string[] args) { string[] s = Console.ReadLine().Split(' '); string[] t = Console.ReadLine().Split(' '); long K = long.Parse(s[1]); long C = 0; long[] p = new long[long.Parse(s[0])]; for (int i = 0; i < t.Length; i++) p[i] = long.Parse(t[i]); for (int i = 0; i < p.Length; i++) { long min = p[i]; long index = 0; for (int j = i;j < p.Length; j++) { if(min > p[j]) { min = p[j]; index = j; } } if(p[i] != min) { long tmp = p[i]; p[i] = p[index]; p[index] = tmp; C++; } } if((K - C) % 2 == 0) { Console.WriteLine("{0}", "YES"); } else { Console.WriteLine("{0}", "NO"); } //Console.ReadLine(); } } }