The language of the round is Kotlin. Kotlin is a statically-typed programming language that runs on the Java Virtual Machine and also can be compiled to JavaScript source code. Its primary development is from a team of JetBrains programmers based in Saint Petersburg, Russia (the name comes from the Kotlin Island, near St. Petersburg).
Here is an example of the simplest program on Kotlin to print sum of two numbers:
fun main(args: Array<String>) {
val (x, y) = readLine()!!.split(' ').map(String::toInt)
println(x + y)
}
Here are some links to help you with Kotlin:
- https://en.wikipedia.org/wiki/Kotlin_(programming_language)
- https://kotlinlang.org/docs/reference/
- http://try.kotlinlang.org/ — be careful: reading from the console in the web-IDE is not allowed
- and Google!
You can download standalone compiler (version 1.0.1) by the link http://s.codeforces.com/files/kotlin-compiler-1.0.1.zip Also you need JRE (virtual Java machine), you can find it by the link http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
The password from the archives with IDEA (IDE supporting Kotlin out of the box): c8bf9dd9b91ad9ff Links to IDEA are below or you can download it from the official website
Good luck!
====
UPD: You can predownload development pack (sorry, 300MB). In fact, you can take part without it — the Custom Invocation tab will be available during the contest. Also we will publish more compact tools 30 minutes before the start.
OS | |
---|---|
Linux | http://s.codeforces.com/files/683-linux.7z |
Windows | http://s.codeforces.com/files/683-windows.7z |
Mac OS | http://s.codeforces.com/files/683-macos.7z |
All archives are encrypted. The password will be announced 30 minutes before the contest.
========
Surprise Language Round #8 will start on June 16, 16:00 (UTC). It will be unusual entertaining contest. Solutions on the only programming language will be allowed.
Thus, it is expected that during the round, participants can get acquainted with the language and solve a few simple problems. The language will be announced 30 minutes before the start of the round. At the same time (or earlier but encrypted archives) we will publish the archives with the tools to write programs in this language.
I am pleased to announce that the top 20 participants will receive an exclusive t-shirt, and another 10 random participants among those who solved at least three problems will receive an exclusive t-shirt too.
The rules of the contest are as follows:
- The contest is unrated for everybody.
- The round uses ACM ICPC rules: the standing is defined by the number of solved problems, ties are resolved based on penalty time. Initially the penalty is 0, and for each solved problem it is increased by submission time (since the start of the contest) + 20 minutes for each failed submission. The solution is considered to be correct if it passes all tests from a predefined test set; you know whether the solution is right immediately after sending it. There are no hacks.
- The round will have 8-10 problems, sorted by estimated complexity, and you have 2 hours to solve it.
- Solutions are accepted only in one language, which will be announced in 30 minutes before the contest.
- Please reread this post at the beginning of the contest: we will announce the language and add instructions to install the compiler (the contest interface will provide an option to run your solutions online as well) and links to useful manuals. Other than that, learning the language is up to the competitor. You can use any resources to solve the problems (as long as you remember that this is an individual competition); you don't have to limit yourself to the manuals provided in the post.
Good luck!
First SLR I'm eligible to participate in in 5 years.
9 am on a weekday in my time zone.
:-(
Take the morning off?
It is awesome that Surprise Language Round comes back since the previous Surprise Language Round was 21 months ago.
Unless you count VK Cup 2015 Wildcard Round 1 15 months ago and VK Cup 2016 Wildcard Round 1 2 months ago, which both used SLR format and both had parallel rounds open to everybody.
Or do you feel nostalgic about the name "Surprise Language Round" itself? :-)
In fact, this contest is interesting, and I want to participant it.
My dream is going to get a T-Shirt. Can you pray for me?
Okey ....
I Can Pray. But I really can't Prey ....
Oh,sorry. but I can beat you.
A moment of silence for our dear departed friend, English.
Spray the Helix Fossile!
Hi, I am new to CodeForces competitions, and this will be first one. Will the programming language be something completely new(like an unknown language)? Or will it be like a custom/madeup language?
thanks pimaster314
It will be an existing but esoteric programming language. You can see the languages used in previous surprise language rounds in the link below.
http://codeforces.me/blog/entry/13750
Tshirt! registered. :)
Really excited related to this contest, it will be fun to know a completely new language. Contest Like these makes coding and codeforces interesting.
Exclusive! Exclusive!. How this is exclusive?! Can we see it?
Not gonna lie, I registered for the T-shirts.
Lol. I updated my Tshirt size, just in case ;-)
LoL. Reminds me of the time when I hurried up in updating my Tshirt size after I won one. I never actually cared because I never though I'll get one ;)
I never updated my T-shirt size on baylor site so I recieved an XL T-Shirt.
I switched it with my team mate and he still doesn't know about it why did he got a XL T-shirt xD .
lol I did the same xD
!!!
T-shirts
NO!!I haven't finished downloading it yet. Is there any way to get it faster?
First link, the wikipedia one, is broken I can't click on it, only copy and paste to address bar works.
which compiler should i select in custom test?
Kotlin? It seems that the next SLR is going to have C++ as the only language:) Btw, it surely will be a great surprise:)
+1 This is so similar to Scala :/
There isn't much of a surprise.
+1
They might be choosing Kotlin for introducing some harder task to SLR, but Kotlin is way too common (and too sane). Quite different from old SLRs by Nickolas.
Well, next time you can do this for Rust, or Elixir, or whatever.
Yeah, rust sounds pretty interesting.
Kotlin is too common to be fair. People who are familiar with the language (or even with Java) has a clear advantage.
still cant figure out how to read input >_>
Me too :(
this can solve the first problem,but i dont know how to read a string :(
Why var y = readLine()
and not:
val y = readLine()
As I understand, we can't change the value of val
I am unable to compile my source code from given compiler. Any help?
I guess you forget to add header files
I cant find any courses that tell me how to read a string or read input one by one:(
How to use the compiler? The IDE told me that I did not have Project SDK.
Random winners of 10 t-shirts will be determined using the following code (testlib is used). The code will be executed with two parameters in the command line: number of participants with at least 3 problems and penalty of the lowest among them.
That was one of the most interesting contests I've ever participated btw.
Many congratulations to t-shirt winners (1-20):
And random winners (yes, 12 t-shirts because of ties):
I wish I had 187th rank rather than 87th :/
Lel I wish I had 26 instead of my 25 :D
Aww! Missed the T-shirt, but it's always fun doing SLRs. Wish they are held more frequently.
MishaPrigara took 117 place, not 177. Check it please
Oh, I missed. Thanks, fixed. I'll ask for exta t-shirt for MishaPrigara.
The contest was awesome Mike, Thank you.
About the t-shirt, I didn't receive an email or any sort of thing. So, please email me at [email protected]
Thanks.
This code crashes if n ≤ 30.
I just hacked MikeMirzayanov!
O(N lg K) was supposed to pass on G?
I got TLE on #21 :/
You meant H? Not sure about O(NlgK), solved it with O(N).
Yeah H, how in O(N).
I used binary jumping for N lg K.
Iterate over every student, build cycles for them — it is O(N)
For every cycle get shift = K % cycle_len, for every student in cycle get his new book from (i — shift) pos in cycle (if lesser than 0 += cycle_len). It is O(N) too.
Solved it with O(NlogK): 18526851. I'm guessing your solution is slower than mine because of large array.
Ah! I made the mistake of storing the whole precalc table :/ Should have done it on the fly.
Ah, placed 25, so close.
What is wrong with this for C?
I get Runtime Error on test 17: 18529037
You should try to write simpler code.
http://codeforces.me/contest/683/submission/18525180
MUCH simpler
Much simpler
I get it that this isn't the most elegant way to do it, but I had no idea about these
contains
functions, still what is wrong with my code? The thing I did was mostly straightforward, dont understand why it would get RE :/Probably, there were two consecutive space between numbers. You could filter them out or just don't convert a string to int: 18525267
To add to what others have said, you read 2 chars per number, but the numbers can range from -1000 to 1000. So even if the input does not have consecutive spaces, you can end up with
stringerA
starting with a space, which then causes this exception. Even if it didn’t throw this exception though, you would still get a wrong answer because you’d parse the numbers wrongly.Round is very interesting and educational.
Thank you.
I submitted solution for E, got TLE, so I decided to rewrite code from Java. I copy-pasted the Java code to the Kotlin file and IDEA asked: "Do you want to convert it to Kotlin code?". I clicked "Yes" and this way I got E accepted without writing a lot of Kotlin code. I wish I knew the copy-pasting rule from the beginning of the contest.
Yea, sounds cheaty from the perspective of non-Java participant :)
Definitely sounds like that. Before copy-pasting I was prepared for a long process of manual conversion from the language I knew into the language that I didn't know, so that wouldn't be so different if the source language was C++ (or any other language). The process would probably be errorprone and given the size of the SetWithCount class my initial thought was that the chances of successful conversion are slim but I had no better idea. After learning that one can convert code from Java to Kotlin I wrote solution to G in Kotlin without using Java. What's the fun of writing Java solution when it is a Kotlin contest?
Anyway, the "conversion from Java to Kotlin" message was the big "WTF?!!! I was browsing the Reference manual for two hours, while I could have just written everything in Java and then convert?", so I guess the language wasn't the only surprise for me in this contest:)
Heh, before this round, I've just thought, "the author seems to be Mike, so it may be a way to battle-test a new language for regular rounds".
Will Kotlin be available for common rounds now as well?
Did someone used "Convert from java" button of http://try.kotlinlang.org/#/Examples/ ?
Do I get something wrong about J, or it is easier than I?
In J you don't have to find a minimal path, so you can just blow every single wall and exit. 100k actions is more than enough for that.
As a developer working on Kotlin at JetBrains, I'd like to present my solutions for today's problems (except H), maybe they will be of use for someone. (UPD: I did not take part in the round.)
Your B solution looks great. I see that I could have just sorted the students instead of using HashMap<Int, MutableMap<String, Int>>. Such an overkill:) I had a lot of trouble with trying to use Map.computeIfAbsent, because IDEA kept coloring it red, and I finally gave up and used temporary variables. What I wanted to do:
Is there a way to use computeIfAbsent (or getOrElse or getOrPut or something else) to achieve the same effect without using temporary variables?
computeIfAbsent
is not available inkotlin.Map
currently because it breaks variance of Map's generic type parameters. I believe this is being discussed and worked on currently (link).I don't think there's a nice way to write this without using temporary variables :) I can only suggest something like the following:
You don’t need the last
capitalize
call in F, do you?You're right, it's not needed. I've updated the solution. Thanks!
For problem I, I noticed something strange in some accepted solutions:
I thought we needed to minimize the number of pushes. It seems they are printing three pushes, while the optimal solution is only one push.
Can you please share the submission id?
This is mine: 18529203
Seems that it minimizes answer's length :)
Seems like the checker actually accepts any correct sequence at least one of them exists.
One such solution: 18527894
Oh, it seems it is my bug. Thanks. And I did it 12 years ago!
The problem is from Saratov local contest of 2004.
BTW, it is fixed. We will not rejudge contest solutions, but all other solutions have been rejudged.
Regarding the language, I have one feedback comment for now.
When I want a specific construct, I usually Google for it. For the things in the standard library (for example, set or regular expressions), the first link usually invites to read the official API Reference. Its pages list all methods, but I didn't find any single example each time I got there. And it is hard(er) to learn using a construct without an example readily available. So, I usually scrolled the Google results down to find the first link to StackOverflow, and it helped.
The point is, for a new user, it would be nice if the examples came on the first link from a respective Google search. If that link is usually API Reference, it would be nice to have examples right in the API Reference.
Kotlin was indeed a fun language (no pun intended)