Submission #3272249
Source Code Expand
import scala.annotation.tailrec object Main extends App { val max = io.StdIn.readLine().toInt val lines : Seq[Int] = for (_ <- 1 to max ) yield { io.StdIn.readLine().toInt } sortCheck(1, max, lines) match { case Right(str) => println(str) case Left(str) => println(str) } /* * pi−1>pi>pi+1のpi-1とpi+1を好きなだけ入れ替えた場合に、 * 正しくsortできるかをチェックする。 * * 以下のチェック条件に合致すればyes, それ以外はnoを返す。 * ①入力回数が奇数回に渡される数字は奇数であること。 * ②入力回数は偶数回に渡される数字は偶数であること。 * ③重複した値が入力されていないこと。 */ @tailrec def sortCheck(num : Int, max : Int, lines : Seq[Int]) : Either[String, String] = { val yes = "Yes" val no = "No" lines.head match { case i if i % 2 == 1 && num % 2 == 0 => Left(no) // ② case i if i % 2 == 0 && num % 2 == 1 => Left(no) // ① case i if lines.tail.contains(i) => Left(no) // ③ case i if i == max => Right(yes) case _ => sortCheck( num + 1, max, lines.tail) } } }
Submission Info
Submission Time | |
---|---|
Task | F - Revenge of BBuBBBlesort! |
User | Masaka18 |
Language | Scala (2.11.7) |
Score | 0 |
Code Size | 1233 Byte |
Status | WA |
Exec Time | 2111 ms |
Memory | 46180 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 1200 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, 61.txt, 62.txt, 63.txt, 64.txt, 65.txt, 66.txt, 67.txt, 68.txt, 69.txt, 70.txt, 71.txt, 72.txt, 73.txt, 74.txt, 75.txt, 76.txt, 77.txt, 78.txt, 79.txt, 80.txt, 81.txt, 82.txt, 83.txt, 84.txt, 85.txt, 86.txt, 87.txt, 88.txt, 89.txt, 90.txt, 91.txt, 92.txt, 93.txt, 94.txt, 95.txt, 96.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 566 ms | 42564 KB |
02.txt | AC | 508 ms | 43920 KB |
03.txt | AC | 566 ms | 42260 KB |
04.txt | AC | 518 ms | 42280 KB |
05.txt | TLE | 2111 ms | 43988 KB |
06.txt | TLE | 2111 ms | 44076 KB |
07.txt | TLE | 2107 ms | 42396 KB |
08.txt | TLE | 2111 ms | 43792 KB |
09.txt | TLE | 2111 ms | 43804 KB |
10.txt | TLE | 2111 ms | 43888 KB |
11.txt | TLE | 2111 ms | 44212 KB |
12.txt | TLE | 2111 ms | 44088 KB |
13.txt | TLE | 2111 ms | 44168 KB |
14.txt | TLE | 2111 ms | 44088 KB |
15.txt | TLE | 2111 ms | 43940 KB |
16.txt | TLE | 2111 ms | 44000 KB |
17.txt | TLE | 2111 ms | 43984 KB |
18.txt | TLE | 2111 ms | 44044 KB |
19.txt | TLE | 2111 ms | 44212 KB |
20.txt | TLE | 2111 ms | 44048 KB |
21.txt | TLE | 2111 ms | 42360 KB |
22.txt | TLE | 2111 ms | 42180 KB |
23.txt | TLE | 2111 ms | 43972 KB |
24.txt | TLE | 2111 ms | 43980 KB |
25.txt | TLE | 2111 ms | 43968 KB |
26.txt | TLE | 2111 ms | 43964 KB |
27.txt | TLE | 2111 ms | 44180 KB |
28.txt | TLE | 2111 ms | 44112 KB |
29.txt | TLE | 2111 ms | 43652 KB |
30.txt | TLE | 2111 ms | 44016 KB |
31.txt | TLE | 2111 ms | 44908 KB |
32.txt | TLE | 2111 ms | 45880 KB |
33.txt | TLE | 2111 ms | 44052 KB |
34.txt | TLE | 2111 ms | 43924 KB |
35.txt | TLE | 2111 ms | 43848 KB |
36.txt | TLE | 2107 ms | 44096 KB |
37.txt | TLE | 2111 ms | 44224 KB |
38.txt | TLE | 2111 ms | 43980 KB |
39.txt | TLE | 2111 ms | 44008 KB |
40.txt | TLE | 2111 ms | 43924 KB |
41.txt | TLE | 2111 ms | 43892 KB |
42.txt | TLE | 2111 ms | 46160 KB |
43.txt | TLE | 2111 ms | 44064 KB |
44.txt | TLE | 2111 ms | 44168 KB |
45.txt | TLE | 2111 ms | 42760 KB |
46.txt | TLE | 2111 ms | 44260 KB |
47.txt | TLE | 2111 ms | 44116 KB |
48.txt | TLE | 2111 ms | 44076 KB |
49.txt | TLE | 2111 ms | 43960 KB |
50.txt | TLE | 2111 ms | 44496 KB |
51.txt | WA | 529 ms | 44364 KB |
52.txt | AC | 501 ms | 43792 KB |
53.txt | TLE | 2111 ms | 44008 KB |
54.txt | TLE | 2111 ms | 44004 KB |
55.txt | TLE | 2111 ms | 44292 KB |
56.txt | TLE | 2111 ms | 44104 KB |
57.txt | TLE | 2111 ms | 44208 KB |
58.txt | TLE | 2111 ms | 44152 KB |
59.txt | TLE | 2111 ms | 43760 KB |
60.txt | TLE | 2111 ms | 44256 KB |
61.txt | TLE | 2111 ms | 43776 KB |
62.txt | TLE | 2111 ms | 43872 KB |
63.txt | TLE | 2111 ms | 44180 KB |
64.txt | TLE | 2111 ms | 44176 KB |
65.txt | TLE | 2111 ms | 44272 KB |
66.txt | TLE | 2111 ms | 44252 KB |
67.txt | TLE | 2111 ms | 43728 KB |
68.txt | TLE | 2111 ms | 44012 KB |
69.txt | TLE | 2111 ms | 44148 KB |
70.txt | TLE | 2111 ms | 43972 KB |
71.txt | TLE | 2111 ms | 44084 KB |
72.txt | TLE | 2111 ms | 44148 KB |
73.txt | TLE | 2111 ms | 44108 KB |
74.txt | TLE | 2111 ms | 43988 KB |
75.txt | TLE | 2111 ms | 44428 KB |
76.txt | TLE | 2111 ms | 44036 KB |
77.txt | TLE | 2111 ms | 46180 KB |
78.txt | TLE | 2111 ms | 44056 KB |
79.txt | TLE | 2103 ms | 44256 KB |
80.txt | TLE | 2107 ms | 43988 KB |
81.txt | TLE | 2111 ms | 44120 KB |
82.txt | TLE | 2111 ms | 43976 KB |
83.txt | TLE | 2111 ms | 43888 KB |
84.txt | TLE | 2111 ms | 43916 KB |
85.txt | TLE | 2111 ms | 44348 KB |
86.txt | TLE | 2111 ms | 43920 KB |
87.txt | TLE | 2111 ms | 44032 KB |
88.txt | TLE | 2103 ms | 44096 KB |
89.txt | TLE | 2111 ms | 44104 KB |
90.txt | TLE | 2111 ms | 44108 KB |
91.txt | AC | 324 ms | 25280 KB |
92.txt | AC | 315 ms | 25272 KB |
93.txt | AC | 316 ms | 23356 KB |
94.txt | AC | 312 ms | 25140 KB |
95.txt | AC | 316 ms | 25268 KB |
96.txt | WA | 317 ms | 25164 KB |
s1.txt | AC | 315 ms | 25152 KB |
s2.txt | AC | 317 ms | 25160 KB |
s3.txt | AC | 314 ms | 25148 KB |
s4.txt | AC | 314 ms | 25264 KB |