Submission #891647
Source Code Expand
object Main { def main(args: Array[String]): Unit = { val n = io.StdIn.readLine().toInt val a = io.StdIn.readLine().split(' ').map(_.toInt) val b = for (i <- 1 to n) yield { if (a(i - 1) <= i) false else if (a(a(i - 1) - 1) == i) true else false } println(b.filter(_ == true).length) } }
Submission Info
Submission Time | |
---|---|
Task | B - Friendly Rabbits |
User | iTakeshi |
Language | Scala (2.11.7) |
Score | 200 |
Code Size | 346 Byte |
Status | AC |
Exec Time | 640 ms |
Memory | 35568 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 | 536 ms | 21444 KB |
0_01.txt | AC | 448 ms | 21688 KB |
0_02.txt | AC | 412 ms | 21060 KB |
1_00.txt | AC | 410 ms | 21272 KB |
1_01.txt | AC | 629 ms | 34996 KB |
1_02.txt | AC | 621 ms | 35020 KB |
1_03.txt | AC | 631 ms | 34672 KB |
1_04.txt | AC | 618 ms | 35156 KB |
1_05.txt | AC | 630 ms | 34508 KB |
1_06.txt | AC | 640 ms | 34772 KB |
1_07.txt | AC | 621 ms | 34560 KB |
1_08.txt | AC | 590 ms | 28928 KB |
1_09.txt | AC | 619 ms | 35416 KB |
1_10.txt | AC | 621 ms | 35568 KB |
1_11.txt | AC | 587 ms | 26372 KB |