結果
問題 | No.482 あなたの名は |
ユーザー | shinwisteria |
提出日時 | 2017-03-21 00:15:32 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 835 bytes |
コンパイル時間 | 3,314 ms |
コンパイル使用メモリ | 75,808 KB |
実行使用メモリ | 56,952 KB |
最終ジャッジ日時 | 2023-09-18 13:32:45 |
合計ジャッジ時間 | 9,808 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
55,800 KB |
testcase_01 | AC | 124 ms
55,756 KB |
testcase_02 | AC | 125 ms
55,548 KB |
testcase_03 | AC | 122 ms
55,388 KB |
testcase_04 | AC | 123 ms
55,832 KB |
testcase_05 | RE | - |
testcase_06 | AC | 124 ms
55,496 KB |
testcase_07 | AC | 201 ms
56,216 KB |
testcase_08 | AC | 194 ms
56,904 KB |
testcase_09 | AC | 144 ms
55,780 KB |
testcase_10 | AC | 176 ms
56,312 KB |
testcase_11 | AC | 199 ms
56,952 KB |
testcase_12 | AC | 202 ms
56,672 KB |
testcase_13 | RE | - |
testcase_14 | AC | 177 ms
56,416 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.ArrayList; import java.util.Scanner; public class YourName { static ArrayList<Integer> list = new ArrayList<>(); static ArrayList<Integer> cut = new ArrayList<>(); static long K; static int N; public static void main(String[] args) { Scanner s = new Scanner(System.in); N = s.nextInt(); K = s.nextLong(); for(int i = 0;i<N;i++){ list.add(s.nextInt()); cut.add(i); } s.close(); for(int i = 0;i<cut.size();i++){ swtch(cut.get(i)); if(i>=cut.size()){ break; } } if(K > 0&&K%2 == 0){ K = 0; } if(K == 0) System.out.println("YES"); else System.out.println("NO"); } static void swtch(int i){ if(i+1 != list.get(i)){ int t = list.indexOf(i+1); list.set(t, list.get(i)); list.set(i, i+1); cut.remove(cut.indexOf(i+1)); swtch(t); K--; } } }