Skip to content

Instantly share code, notes, and snippets.

@optician
Created October 23, 2017 06:53
Show Gist options
  • Save optician/830cb8fe1212eae055ec9fdfb1cd78a8 to your computer and use it in GitHub Desktop.
Save optician/830cb8fe1212eae055ec9fdfb1cd78a8 to your computer and use it in GitHub Desktop.
scala/java version. About 11sec
import scala.io._
import java.io._
import scala.collection.mutable.ArrayBuffer
object Main {
def main(args: Array[String]): Unit = {
var i = 0
var v1: ArrayBuffer[String] = new ArrayBuffer(10000)
var v2: ArrayBuffer[String] = new ArrayBuffer(10000)
Source.stdin.getLines.foreach{
x =>
val arr = x.split(' ')
v1 += arr(0)
v2 += arr(1)
i += 1
}
val writer = new PrintWriter(System.out)
for {
x <- v1
y <- v2
} yield writer.write(x + y + "\n")
writer.flush()
writer.close()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment