結果
問題 | No.482 あなたの名は |
ユーザー | shinwisteria |
提出日時 | 2017-03-24 16:11:49 |
言語 | Java19 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 713 bytes |
コンパイル時間 | 4,604 ms |
コンパイル使用メモリ | 73,728 KB |
実行使用メモリ | 77,340 KB |
最終ジャッジ日時 | 2023-09-20 05:52:53 |
合計ジャッジ時間 | 12,411 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 129 ms
56,148 KB |
testcase_01 | AC | 131 ms
55,852 KB |
testcase_02 | AC | 130 ms
55,652 KB |
testcase_03 | AC | 126 ms
55,884 KB |
testcase_04 | AC | 129 ms
55,696 KB |
testcase_05 | AC | 127 ms
55,552 KB |
testcase_06 | AC | 129 ms
55,792 KB |
testcase_07 | AC | 213 ms
56,604 KB |
testcase_08 | AC | 205 ms
56,348 KB |
testcase_09 | AC | 149 ms
55,612 KB |
testcase_10 | AC | 181 ms
55,804 KB |
testcase_11 | AC | 210 ms
56,260 KB |
testcase_12 | AC | 215 ms
56,608 KB |
testcase_13 | AC | 188 ms
55,876 KB |
testcase_14 | AC | 175 ms
55,696 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Queue; import java.util.Scanner; public class YourName2 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int N = s.nextInt(); long K = s.nextLong(); ArrayList<Integer> D = new ArrayList<>(); for(int i = 0;i<N;i++){ D.add(s.nextInt()); } s.close(); Queue<Integer> C = new ArrayDeque<>(); C.addAll(D); while(C.size() > 0){ int i = C.poll(); int k = D.indexOf(i); while(k != i-1){ int A = D.get(i-1); i = A; K--; C.remove(i); } } if(K > 0&&K%2 == 0){ K = 0; } if(K == 0) System.out.println("YES"); else System.out.println("NO"); } }