提出 #896176
ソースコード 拡げる
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int[] num = new int[a];
for (int i = 0; i < a; i++) {
num[i] = sc.nextInt();
}
sc.close();
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int i = 0; i < a; i++) {
if (i + 1 <= num[i]) {
map.put(i + 1, num[i]);
}
else {
map.put(num[i], i + 1);
}
}
System.out.println(a - map.size());
}
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - 仲良しうさぎ |
| ユーザ | jchristian19 |
| 言語 | Java8 (OpenJDK 1.8.0) |
| 得点 | 0 |
| コード長 | 521 Byte |
| 結果 | WA |
| 実行時間 | 508 ms |
| メモリ | 33812 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 200 | ||||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 0_00.txt, 0_01.txt, 0_02.txt |
| All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 0_00.txt | AC | 125 ms | 9672 KiB |
| 0_01.txt | WA | 126 ms | 9556 KiB |
| 0_02.txt | AC | 127 ms | 9676 KiB |
| 1_00.txt | AC | 125 ms | 9684 KiB |
| 1_01.txt | AC | 494 ms | 32488 KiB |
| 1_02.txt | WA | 495 ms | 32304 KiB |
| 1_03.txt | WA | 485 ms | 32504 KiB |
| 1_04.txt | WA | 476 ms | 33812 KiB |
| 1_05.txt | WA | 477 ms | 32996 KiB |
| 1_06.txt | WA | 484 ms | 32412 KiB |
| 1_07.txt | WA | 508 ms | 33448 KiB |
| 1_08.txt | WA | 369 ms | 31784 KiB |
| 1_09.txt | WA | 468 ms | 32464 KiB |
| 1_10.txt | WA | 439 ms | 30800 KiB |
| 1_11.txt | WA | 308 ms | 27704 KiB |