Skip to content

Instantly share code, notes, and snippets.

@jinuk17
Created July 29, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinuk17/04fed79d16a2e8bfc4b294f65cdb5a61 to your computer and use it in GitHub Desktop.
Save jinuk17/04fed79d16a2e8bfc4b294f65cdb5a61 to your computer and use it in GitHub Desktop.
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