Submission #1674539
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0 ; i < n ; i++) { a[i] = sc.nextInt(); } int ans = 0; for(int i = 0 ; i < n ; i++) { int pos = a[i] - 1; if(a[pos] == pos) { ans++; } } System.out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | kouta1612 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 405 Byte |
Status | WA |
Exec Time | 454 ms |
Memory | 50420 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 97 ms | 20692 KB |
0_01.txt | AC | 98 ms | 21332 KB |
0_02.txt | WA | 95 ms | 21844 KB |
1_00.txt | AC | 99 ms | 19028 KB |
1_01.txt | WA | 423 ms | 50376 KB |
1_02.txt | AC | 454 ms | 50036 KB |
1_03.txt | WA | 429 ms | 47948 KB |
1_04.txt | WA | 442 ms | 48292 KB |
1_05.txt | WA | 420 ms | 50420 KB |
1_06.txt | WA | 417 ms | 49060 KB |
1_07.txt | AC | 425 ms | 45964 KB |
1_08.txt | WA | 306 ms | 44112 KB |
1_09.txt | AC | 403 ms | 46436 KB |
1_10.txt | WA | 383 ms | 46592 KB |
1_11.txt | WA | 227 ms | 38000 KB |