CODE FESTIVAL 2016 qual A

Submission #1676543

Source codeソースコード

#!/usr/bin/env python3
# -*- coding: utf-8 -*-



def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    A = tuple(a-1 for a in A) # 0-based

    ans = 0
    for i in range(N):
        b = A[i]
        if A[b] == i:
            ans += 1

    ans //= 2
    print(ans)

if __name__ == "__main__": main()

Submission

Task問題 B - 仲良しうさぎ / Friendly Rabbits
User nameユーザ名 vabuff
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 200
Source lengthソースコード長 325 Byte
File nameファイル名
Exec time実行時間 61 ms
Memory usageメモリ使用量 14008 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 200 / 200 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

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 17 ms 3064 KB
0_01.txt AC 17 ms 2940 KB
0_02.txt AC 17 ms 3060 KB
1_00.txt AC 17 ms 2940 KB
1_01.txt AC 61 ms 14008 KB
1_02.txt AC 57 ms 13940 KB
1_03.txt AC 58 ms 13940 KB
1_04.txt AC 57 ms 13940 KB
1_05.txt AC 57 ms 14008 KB
1_06.txt AC 57 ms 13940 KB
1_07.txt AC 58 ms 13940 KB
1_08.txt AC 31 ms 6764 KB
1_09.txt AC 51 ms 12444 KB
1_10.txt AC 45 ms 10184 KB
1_11.txt AC 23 ms 4780 KB