Submission #3269311
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 } println(sortCheck(1, max, lines)) /* * 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 => Right(no) // ② case i if i % 2 == 0 && num % 2 == 1 => Right(no) // ① case i if lines.tail.contains(i) => Right(no) // ③ case i if i == max => Left(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 | 1159 Byte |
Status | WA |
Exec Time | 2111 ms |
Memory | 45892 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 | WA | 584 ms | 42732 KB |
02.txt | WA | 502 ms | 43696 KB |
03.txt | WA | 568 ms | 43980 KB |
04.txt | WA | 508 ms | 43876 KB |
05.txt | TLE | 2111 ms | 44164 KB |
06.txt | TLE | 2111 ms | 43840 KB |
07.txt | TLE | 2111 ms | 44144 KB |
08.txt | TLE | 2111 ms | 44164 KB |
09.txt | TLE | 2111 ms | 44140 KB |
10.txt | TLE | 2111 ms | 43704 KB |
11.txt | TLE | 2111 ms | 43616 KB |
12.txt | TLE | 2111 ms | 42472 KB |
13.txt | TLE | 2111 ms | 44332 KB |
14.txt | TLE | 2111 ms | 43860 KB |
15.txt | TLE | 2107 ms | 44232 KB |
16.txt | TLE | 2111 ms | 43948 KB |
17.txt | TLE | 2111 ms | 44232 KB |
18.txt | TLE | 2111 ms | 43912 KB |
19.txt | TLE | 2111 ms | 44296 KB |
20.txt | TLE | 2111 ms | 43800 KB |
21.txt | TLE | 2111 ms | 43616 KB |
22.txt | TLE | 2111 ms | 43868 KB |
23.txt | TLE | 2111 ms | 44188 KB |
24.txt | TLE | 2111 ms | 44020 KB |
25.txt | TLE | 2111 ms | 44040 KB |
26.txt | TLE | 2111 ms | 44396 KB |
27.txt | TLE | 2111 ms | 43756 KB |
28.txt | TLE | 2111 ms | 44104 KB |
29.txt | TLE | 2111 ms | 43576 KB |
30.txt | TLE | 2111 ms | 43992 KB |
31.txt | TLE | 2111 ms | 44424 KB |
32.txt | TLE | 2111 ms | 41960 KB |
33.txt | TLE | 2111 ms | 43928 KB |
34.txt | TLE | 2111 ms | 44084 KB |
35.txt | TLE | 2111 ms | 44264 KB |
36.txt | TLE | 2111 ms | 44172 KB |
37.txt | TLE | 2111 ms | 43956 KB |
38.txt | TLE | 2111 ms | 43928 KB |
39.txt | TLE | 2111 ms | 42356 KB |
40.txt | TLE | 2111 ms | 43872 KB |
41.txt | TLE | 2111 ms | 44280 KB |
42.txt | TLE | 2111 ms | 44020 KB |
43.txt | TLE | 2107 ms | 43572 KB |
44.txt | TLE | 2111 ms | 44016 KB |
45.txt | TLE | 2111 ms | 44292 KB |
46.txt | TLE | 2111 ms | 44628 KB |
47.txt | TLE | 2111 ms | 43944 KB |
48.txt | TLE | 2111 ms | 44088 KB |
49.txt | TLE | 2111 ms | 43992 KB |
50.txt | TLE | 2111 ms | 44344 KB |
51.txt | WA | 526 ms | 42196 KB |
52.txt | WA | 503 ms | 43772 KB |
53.txt | TLE | 2111 ms | 43940 KB |
54.txt | TLE | 2111 ms | 43532 KB |
55.txt | TLE | 2111 ms | 44184 KB |
56.txt | TLE | 2111 ms | 43896 KB |
57.txt | TLE | 2111 ms | 43936 KB |
58.txt | TLE | 2111 ms | 44264 KB |
59.txt | TLE | 2111 ms | 43896 KB |
60.txt | TLE | 2111 ms | 43988 KB |
61.txt | TLE | 2111 ms | 44832 KB |
62.txt | TLE | 2111 ms | 44564 KB |
63.txt | TLE | 2111 ms | 43888 KB |
64.txt | TLE | 2111 ms | 44092 KB |
65.txt | TLE | 2111 ms | 43984 KB |
66.txt | TLE | 2111 ms | 44500 KB |
67.txt | TLE | 2111 ms | 43732 KB |
68.txt | TLE | 2111 ms | 43916 KB |
69.txt | TLE | 2111 ms | 44272 KB |
70.txt | TLE | 2111 ms | 44300 KB |
71.txt | TLE | 2111 ms | 44044 KB |
72.txt | TLE | 2111 ms | 44564 KB |
73.txt | TLE | 2111 ms | 44136 KB |
74.txt | TLE | 2111 ms | 44264 KB |
75.txt | TLE | 2111 ms | 43892 KB |
76.txt | TLE | 2111 ms | 44012 KB |
77.txt | TLE | 2111 ms | 43720 KB |
78.txt | TLE | 2111 ms | 42540 KB |
79.txt | TLE | 2111 ms | 44144 KB |
80.txt | TLE | 2111 ms | 42168 KB |
81.txt | TLE | 2111 ms | 45892 KB |
82.txt | TLE | 2111 ms | 42436 KB |
83.txt | TLE | 2111 ms | 42500 KB |
84.txt | TLE | 2111 ms | 44284 KB |
85.txt | TLE | 2111 ms | 43952 KB |
86.txt | TLE | 2111 ms | 44008 KB |
87.txt | TLE | 2111 ms | 44200 KB |
88.txt | TLE | 2111 ms | 42572 KB |
89.txt | TLE | 2111 ms | 44240 KB |
90.txt | TLE | 2111 ms | 42196 KB |
91.txt | WA | 326 ms | 25168 KB |
92.txt | WA | 315 ms | 25272 KB |
93.txt | WA | 319 ms | 25252 KB |
94.txt | WA | 315 ms | 23500 KB |
95.txt | WA | 319 ms | 25272 KB |
96.txt | WA | 317 ms | 25152 KB |
s1.txt | WA | 317 ms | 25152 KB |
s2.txt | WA | 316 ms | 25284 KB |
s3.txt | WA | 315 ms | 25156 KB |
s4.txt | WA | 318 ms | 23468 KB |