結果
問題 |
No.482 あなたの名は
|
ユーザー |
![]() |
提出日時 | 2020-02-05 14:06:25 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 693 bytes |
コンパイル時間 | 2,241 ms |
コンパイル使用メモリ | 74,216 KB |
実行使用メモリ | 67,508 KB |
最終ジャッジ日時 | 2024-09-22 12:07:11 |
合計ジャッジ時間 | 18,106 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 13 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextLong(); int[] arr = new int[n + 1]; for (int i = 1; i <= n; i++) { arr[i] = sc.nextInt(); } int count = 0; for (int i = 1; i <= n; i++) { if (i != arr[i]) { int x = arr[i]; arr[i] = arr[x]; arr[x] = x; count++; } } if (k % 2 == count % 2) { System.out.println("YES"); } else { System.out.println("NO"); } } }