On Sunday, April 7, 2019 at 7:22:22 AM UTC+2, meir wrote:
> I was happy to see Scala was added to the supported languages. It's my
> language of choice and writing in a language I don't use daily not only slows
> me down it isn't as fun.
>
> I was unable to use Scala at all in the qualification round. I wrote short
> O(input length) solutions for the first two problems and they both timed out.
> Presumably due to extended compilation time. Locally each compiled in less
> than 2 seconds wall time. And less than 4 cpu seconds.
>
> Scala is actually a fairly speedy language at runtime. But if you setup the
> environment and time limits so that essentially any Scala program will use
> most if not all it's time budget compiling it means Scala isn't actually
> supported.
>
> Time limits in the 10 second vacinity beg for compilation or warm up issues.
> The 4-8 minute range was far better and these could always be neglected.
>
> I liked the pre 2018 platform better.
>
> Please support Scala for real!
> Significant time budget, dedicated compile budget or any other solution which
> will make it a real option.
This solution passes all tests for me:
object Solution {
def main(args: Array[String]) {
var t = scala.io.StdIn.readLine().toInt
for( cas <- 1 to t) {
var line = scala.io.StdIn.readLine()
var a = ""
var b = ""
for( i <- 0 to line.size-1) {
if (line.charAt(i) == '4') {
a += "2"
b += "2"
} else {
a += line.charAt(i)
b += "0"
}
}
println( s"Case #$cas: $a $b" );
}
}
}
I have found that extending App will give me either CTLE or TLE. Sometimes
resubmitting a CTLE solution will make it work. Here is an example that fails:
object Solution extends App {
var t = scala.io.StdIn.readLine().toInt
for( cas <- 1 to t) {
var line = scala.io.StdIn.readLine()
var a = ""
var b = ""
for( i <- 0 to line.size-1) {
if (line.charAt(i) == '4') {
a += "2"
b += "2"
} else {
a += line.charAt(i)
b += "0"
}
}
println( s"Case #$cas: $a $b" );
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/89b04038-ab39-4b1b-be58-6f99a46b4dc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.