Created
July 29, 2016 12:46
-
-
Save jinuk17/04fed79d16a2e8bfc4b294f65cdb5a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jayden | |
/** | |
* Created by jaydenuk on 2016. 7. 29.. | |
*/ | |
object RankAndFileMain extends App{ | |
def missingList(l: Seq[Seq[Int]]): Seq[Int] = | |
l.flatten.groupBy(identity).mapValues(_.size).filter{case (k, v) => v % 2 > 0}.keySet.toSeq.sorted | |
def process(lines: Iterator[String])(writer: java.io.PrintWriter) = for(i <- 1 to lines.next().toInt) { | |
val n = lines.next().toInt | |
val ans = missingList(Seq.fill(2*n-1){lines.next().split(" ").map(_.toInt).toList}) | |
writer.println(s"Case #$i: ${ans mkString " "}") | |
} | |
val filename = "B-large-practice" | |
val writer = new java.io.PrintWriter(filename + ".out") | |
try { | |
process(io.Source.fromFile(filename + ".in").getLines)(writer) | |
} finally { | |
writer.flush(); writer.close() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment