Submission #2739543


Source Code Expand

# -*- coding: utf-8 -*-
# AtCoder Beginner Contest


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    count = 0

    for i in range(len(a)):
        k = a[i] - 1

        if a[i] != -999 and a[k] != -999:
            if (i + 1) == a[k] and (a[i] - 1) == a.index(a[k]):
                count += 1

                a[i] = -999
                a[k] = -999

    print(count)

Submission Info

Submission Time
Task B - Friendly Rabbits
User hiro_hiro
Language Python (3.4.3)
Score 0
Code Size 434 Byte
Status WA
Exec Time 2104 ms
Memory 13880 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
AC × 3
AC × 10
WA × 3
TLE × 2
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 17 ms 3060 KB
0_01.txt AC 17 ms 3060 KB
0_02.txt AC 17 ms 3060 KB
1_00.txt AC 17 ms 2940 KB
1_01.txt TLE 2104 ms 13880 KB
1_02.txt AC 80 ms 13880 KB
1_03.txt TLE 2104 ms 13812 KB
1_04.txt WA 500 ms 13812 KB
1_05.txt WA 134 ms 13880 KB
1_06.txt WA 82 ms 13880 KB
1_07.txt AC 78 ms 13812 KB
1_08.txt AC 39 ms 7024 KB
1_09.txt AC 67 ms 12316 KB
1_10.txt AC 57 ms 10468 KB
1_11.txt AC 27 ms 4652 KB