Submission #42003


Source Code Expand

tuple2Num (n1, n2) = ssum(n1 + n2 - 2) + n2
plus (n1, n2) (n3 , n4) = (n1 + n3, n2 + n4)
ssum n = floor (fromIntegral(n * (n + 1)) / fromIntegral 2)
dev n1 n2 = floor(fromIntegral n1 / fromIntegral n2)

num2Tuple n start end | n <= ssum (m - 1) = (num2Tuple n start (end - (dev (end - start) 2)))
										| ssum m < n = num2Tuple n (start + (dev (end - start) 2)) end
										| otherwise = calc n m
											where m = dev (start + end) 2

calc n m = (m + 1 - d, d)
	where d = n - ssum (m - 1)

main = do
	abc <- fmap words getLine
	print $ tuple2Num $ plus (num2Tuple ((read :: String -> Int) (abc !! 0)) 0 15000) (num2Tuple ((read :: String -> Int) (abc !! 1)) 0 15000)

Submission Info

Submission Time
Task C - 紅茶(Tea)
User mkiken
Language Haskell (GHC 7.4.1)
Score 1500
Code Size 695 Byte
Status AC
Exec Time 50 ms
Memory 1492 KB

Judge Result

Set Name All
Score / Max Score 1500 / 1500
Status
AC × 35
Set Name Test Cases
All 01-1.txt, 01-2.txt, 01-3.txt, 01-4.txt, 01-5.txt, 02-1.txt, 02-2.txt, 02-3.txt, 02-4.txt, 02-5.txt, 03-1.txt, 03-2.txt, 03-3.txt, 03-4.txt, 03-5.txt, 04-1.txt, 04-2.txt, 04-3.txt, 04-4.txt, 04-5.txt, 05-1.txt, 05-2.txt, 05-3.txt, 05-4.txt, 05-5.txt, 06-1.txt, 06-2.txt, 06-3.txt, 06-4.txt, 06-5.txt, 07-1.txt, 07-2.txt, 07-3.txt, 07-4.txt, 07-5.txt
Case Name Status Exec Time Memory
01-1.txt AC 50 ms 1408 KB
01-2.txt AC 28 ms 1416 KB
01-3.txt AC 26 ms 1412 KB
01-4.txt AC 27 ms 1396 KB
01-5.txt AC 25 ms 1484 KB
02-1.txt AC 27 ms 1412 KB
02-2.txt AC 27 ms 1480 KB
02-3.txt AC 26 ms 1396 KB
02-4.txt AC 25 ms 1392 KB
02-5.txt AC 27 ms 1404 KB
03-1.txt AC 27 ms 1392 KB
03-2.txt AC 26 ms 1408 KB
03-3.txt AC 28 ms 1404 KB
03-4.txt AC 28 ms 1404 KB
03-5.txt AC 28 ms 1492 KB
04-1.txt AC 25 ms 1404 KB
04-2.txt AC 29 ms 1488 KB
04-3.txt AC 27 ms 1396 KB
04-4.txt AC 28 ms 1420 KB
04-5.txt AC 29 ms 1396 KB
05-1.txt AC 25 ms 1412 KB
05-2.txt AC 27 ms 1408 KB
05-3.txt AC 26 ms 1400 KB
05-4.txt AC 32 ms 1476 KB
05-5.txt AC 26 ms 1400 KB
06-1.txt AC 24 ms 1404 KB
06-2.txt AC 28 ms 1488 KB
06-3.txt AC 27 ms 1404 KB
06-4.txt AC 27 ms 1396 KB
06-5.txt AC 27 ms 1400 KB
07-1.txt AC 27 ms 1400 KB
07-2.txt AC 27 ms 1400 KB
07-3.txt AC 25 ms 1408 KB
07-4.txt AC 25 ms 1400 KB
07-5.txt AC 29 ms 1400 KB