Submission #891129
Source Code Expand
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N = int(raw_input()) a = map(int, raw_input().split()) ans = 0 used = [False]*N for i in xrange(N): if not used[i]: if a[a[i] - 1] == i + 1 and not used[a[i] - 1]: ans += 1 used[a[i] - 1] = True print ans
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | roiti |
Language | Python (2.7.6) |
Score | 200 |
Code Size | 364 Byte |
Status | AC |
Exec Time | 134 ms |
Memory | 12648 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 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 | 134 ms | 4520 KB |
0_01.txt | AC | 27 ms | 4008 KB |
0_02.txt | AC | 27 ms | 4008 KB |
1_00.txt | AC | 27 ms | 4008 KB |
1_01.txt | AC | 100 ms | 12648 KB |
1_02.txt | AC | 93 ms | 12648 KB |
1_03.txt | AC | 96 ms | 12648 KB |
1_04.txt | AC | 92 ms | 12648 KB |
1_05.txt | AC | 96 ms | 12648 KB |
1_06.txt | AC | 93 ms | 12648 KB |
1_07.txt | AC | 98 ms | 12648 KB |
1_08.txt | AC | 51 ms | 7204 KB |
1_09.txt | AC | 81 ms | 11088 KB |
1_10.txt | AC | 73 ms | 10008 KB |
1_11.txt | AC | 38 ms | 5284 KB |