Автор BledDest, история, 4 года назад, По-английски

Hello, Codeforces!

First and foremost, we would like to say a massive thank you to everyone who entered and submitted their answers to the first, second, third, and fourth Kotlin Heroes competitions which were held previously: Episode 1, Episode 2, Episode 3 and Episode 4.

Ready to challenge yourself to do better? The Kotlin Heroes 5: ICPC Round competition will be hosted on the Codeforces platform on Nov/12/2020 17:35 (Moscow time). The contest will last 2 hours 30 minutes and will feature a set of problems from simple ones, designed to be solvable by anyone, to hard ones, to make it interesting for seasoned competitive programmers.

Prizes:

Top three winners will get prizes of $512, $256, and $128 respectively, top 50 will win a Kotlin Heroes t-shirt and an exclusive Kotlin sticker, competitors solving at least one problem will enter into a draw for one of 50 Kotlin Heroes t-shirts.

Everyone who takes part in this round will get an electronic Participation Certificate.

There is also a special recognition prize from the ICPC: ICPC- experience, an invitation to the Moscow World Finals 2021, all-inclusive on-site (hotel, meals, ceremonies, and swag, are included; visa, flights, transportation to the contest location is not).

Registration is already open and available via the link. It will be available until the end of the round.

The round will again be held in accordance with a set of slightly modified ICPC rules:

  • The round is unrated.
  • The contest will have 9 problems of various levels of complexity.
  • You are only allowed to use Kotlin to solve these problems.
  • Participants are ranked according to the number of correctly solved problems. Ties are resolved based on the lowest total penalty time for all problems, which is computed as follows. For each solved problem, a penalty is set to the submission time of that problem (the time since the start of the contest). An extra penalty of 10 minutes is added for each failed submission on solved problems (i. e., if you never solve the problem, you will not be penalized for trying that problem). If two participants solved the same number of problems and scored the same penalty, then those of them who had previously made the last successful submission will be given an advantage in the distribution of prizes and gifts.

REGISTER →

If you are still new to Kotlin we have prepared a tutorial on competitive programming in Kotlin and Kotlin Heroes 5: ICPC Round (Practice), where you can try to solve a few simple problems in Kotlin. All the solutions are open, which means that you can look at the solution even if you haven't solved the problem yet. The practice round is available by the link.

We wish you luck and hope you enjoy Kotlin.

UPD: The editorial can be found here.

  • Проголосовать: нравится
  • +165
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Aim for the T-shirt!

»
4 года назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

No DIV 2 contest before 13/Nov. :-(

»
4 года назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

I have a question about the new electronic certificate: Is the real name printed on the certificate or just the handle on cf?

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

I don't know how to use Kotlin :-(

And there is no other contests until Nov.13 :-(

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This announcement blog is not added to the Kotlin Heroes Page. Please add it there also.
BledDest

»
4 года назад, # |
  Проголосовать: нравится -62 Проголосовать: не нравится

I don't get the reason for promoting a particular language (funding ?). I would be happy if it was some normal $$$choose\ the\ language\ you\ like$$$ contest.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится -6 Проголосовать: не нравится

    Kotlin is a product of the company Jet Brains. As part of their business they provide tools and services related to kotlin.

    It is therefore of fundamental importance for the company that people learn and use Kotlin. That is the reason why they pay to create a contest exclusive for Kotlin.

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится -33 Проголосовать: не нравится

      Makes sense obviously from the Jet Brains perspective, but by allowing such thing codeforces is doing something way too different from what it is known for. Also while upsolving I see it has restriction of kotlin it feels bad and annoying.

      And I fear that the long contest drought maybe to facilitate more participation in this kotlin promoting saga (I hope not). Yeah I know it codeforces is too good a place to say -ve things about but couldn't resist objecting.

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится +33 Проголосовать: не нравится

        To upsolve the problems in a different language, you can create a mashup and add problems from Kotlin contest there. That way, they can be solved with any language.

»
4 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

All the solutions are open, which means that you can look at the solution even if you haven't solved the problem yet.

Doesn't seem like it, I can't see any solutions.

»
4 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

How do you win ICPC prize?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +20 Проголосовать: не нравится

    The winner of the Kotlin Heroes X ICPC round will win the ICPC experience, an invitation to the Moscow World Finals 2021, all-inclusive on-site (hotel, meals, ceremonies, and swag, are included; visa, flights, transportation to the contest location is not)

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Need Help ASAP!!

Following code Throws a runtime error on test 1 for the problem A+B (Trial Problem) in Kotlin Heroes 5: ICPC Round (Practice):

fun main()
{
    val t=readLine()!!.toInt()
    for(tt in 1..t)
    {
        var n=readLine()!!.toInt()
        var m=readLine()!!.toInt()
        println("${n+m}")
    }
}

[contest:1432][problem:A]

»
4 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

noooo, I didn't know it could only be written in kotlin. is this rated?

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What is wrong with this:

var aa=mutableListOf<Pair<Int,Int>>()
// do something with aa
aa.sort()

The compiler says:

d.kt:21:8: error: none of the following functions can be called with the arguments supplied:
public inline fun <T> MutableList<TypeVariable(T)>.sort(comparison: (TypeVariable(T), TypeVariable(T)) -> Int): Unit defined in kotlin.collections
public inline fun <T> MutableList<TypeVariable(T)>.sort(comparator: kotlin.Comparator<in TypeVariable(T)> /* = java.util.Comparator<in TypeVariable(T)> */): Unit defined in kotlin.collections
    aa.sort()

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Well, I was able to solve the sorting issue, the problem seems to be that there is no default sorting for Pair, so we need to define the comparator.

    However, shortly after I was stuck googling "kotlin how to add element to sorted set" and was not able to find a way in contest time :/

    This mutable/unmutable collections things do not look very practical to me.

»
4 года назад, # |
  Проголосовать: нравится +27 Проголосовать: не нравится

I think the chance of getting the lucky t-shirts should increase with the number of problems you solved to encourage people to solve more problems.

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Learnt to take input output in kotlin one hour after the contest begun and somehow managed to write correct code first problem . Learning the syntax of language during the contest was too much fun..

»
4 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

Enjoyable contest — my first time (except for the practice round) doing Kotlin. Thanks to the organisers.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there a greedy solution to problem G?

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +53 Проголосовать: не нравится

I had never written a line of Kotlin before last night--suffice it to say that I'm glad I gave it a try!

I thought a lot of the problems from this round were very high-quality, but I especially enjoyed solving I--I had never seen the trick enabling us to maintain a trie while deleting the first letter of each word, and I thought it was quite clever and elegant. Thanks to the authors for the round and to JetBrains for sponsoring the contest!

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Ok, so there IS a solution without any suffix structures, good to know!

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится +9 Проголосовать: не нравится

      You don't need to compare suffixes from distinct columns, thus suffix structures are not required indeed: for each column from right to left, you can build a sorted list of suffixes starting in it, pretty much like radix sort.

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится +43 Проголосовать: не нравится

      Indeed there is! A slightly more detailed explanation of my solution, in case anyone's curious:

      First, observe that the problem reduces to determining the minimum number of times you must switch rows in order to write the query string using characters from the corresponding columns of the input matrix. For example, in the last query of the first sample case, we can take "a" from the first row, then "cbb" from the second row, then "c" from the first row (or either of the third or fourth rows).

      We can use a greedy approach--basically, for each query, pick the row where we'll be able to take the most matching characters before switching rows. It remains to figure out how to quickly determine which row that is and how many matching characters we can take.

      Our approach uses a trie. Construct a trie using the $$$N$$$ rows of the input matrix as our input strings. Then, feed each query string into this trie to figure out how many matching characters we can take before we have to switch rows for the first time.

      Now, if we could construct similar tries starting at each remaining column of the matrix, we could use a similar approach to figure out how many times we have to switch rows for all queries in $$$O(QM).$$$ It turns out that this is possible. Basically, we need to process updates to the trie in which we delete the first character of every string. We can do so by deleting the root node and merging all of the tries created as a result. To merge two tries, we iterate over all possible letters that can follow the root. If only one of the tries has a node corresponding to that letter, that node goes in the merged trie. If both of the tries have nodes corresponding to that letter, then we merge those subtries and put the result in the merged trie.

      Since merging two trie nodes requires a constant amount of work and there are $$$O(NM)$$$ trie nodes, these merges work in $$$O(NM)$$$ time in total. Then, we spend $$$O(M)$$$ time in total feeding each query into the appropriate tries, so our total time complexity is $$$O(M(N+Q)).$$$

      Happy to answer follow-up questions if any of this was unclear!

»
4 года назад, # |
  Проголосовать: нравится +10 Проголосовать: не нравится

The contest has 10 problems, not 9)

»
4 года назад, # |
  Проголосовать: нравится +28 Проголосовать: не нравится

What is test 164 of problem I :(

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +15 Проголосовать: не нравится

    I can't describe what I tried to do with that test (a desperate attempt to hack some tester's solution), but maybe the source code of the generator can help:

    Source code

    It is being run with arguments 2 250000 2.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is it always optimal for Bob to take the smallest possible number in G?

»
4 года назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

Congratulations to tourist yet again!

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone explain the gameprocess in the second testcase in G?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +5 Проголосовать: не нравится

    1). Alice chooses 109, Bob chooses 200

    2). Alice chooses 108, Bob chooses 201

    3). Alice chooses 1, Bob chooses 100

    (201 — 108) + (200 — 109) + (100 — 1) = 283

»
4 года назад, # |
Rev. 5   Проголосовать: нравится +38 Проголосовать: не нравится

If we take seed = 346 (penalty of tourist) and len = 700 (total participants except first 50) the winners of random Kotlin T-shirt are:

56 90 106 111 132 138 158 200 243 245 256 263 270 317 324 339 346 347 359 365 395 403 414 420 422 426 454 457 487 494 503 506 513 551 568 585 595 597 609 616 647 671 672 682 684 695 703 704 705 716

(Information from this comment).

Upd. for new len = 687 new list is:

62 68 74 100 138 141 147 156 184 230 233 239 260 268 287 294 296 301 323 327 353 361 368 376 383 395 398 412 416 431 438 446 450 457 470 472 486 514 535 610 611 622 645 648 653 666 673 695 709 718

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    In final rank there are no 513th rank. two people got 512th rank. How to select 513th rank for random t-shirt winner?

    Screenshot-from-2020-11-13-00-59-53.png

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +12 Проголосовать: не нравится

    remove cheaters?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    In the Rank 645 , there are three people, who will got prizes then?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How has the length changed after so many days? Did they catch some cheaters?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Why len=687? It should be 737 — the total number of participants solved at least 1.

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Your comment here states that The seed will be the total penalty best participants of this contest, the parameter length will be the total number of participants solved at least one problem minus 50.

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Currently, we use randgen.cpp by KAN, it has other semantics for len.

        #include "testlib.h"
        #include <iostream>
        
        using namespace std;
        
        int main(int argc, char *argv[])
        {
            if (argc < 4)
            {
                cout << "Command line arguments are: seed length prefix nwinners" << endl;
                return 1;
            }
            int seed = atoi(argv[1]);
            int len = atoi(argv[2]);
            int prefix = atoi(argv[3]);
            int nwinners = atoi(argv[4]);
            rnd.setSeed(seed);
            
            set<int> winners;    
            while ((int)winners.size() < nwinners)
                winners.insert(rnd.next(prefix + 1, len));
        
            for (int i = 1; i <= prefix; ++i)
                winners.insert(i);
            
            for (auto winner: winners)
                cout << winner << " ";
            cout << endl;
            
            return 0;
        }
        
»
4 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

deleted

»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

amazing contest, glad to take the practice round first :)

»
4 года назад, # |
Rev. 2   Проголосовать: нравится +11 Проголосовать: не нравится

Thank you for the contest, it was really nice one! And I like kotlin and appreciate all your efforts to develop such a nice language, my favorite one ❤️

»
4 года назад, # |
  Проголосовать: нравится +37 Проголосовать: не нравится

When will we receive our certificates and can anyone update me about the t shirt?

»
4 года назад, # |
  Проголосовать: нравится +47 Проголосовать: не нравится

Who are the thsirt winners?

»
4 года назад, # |
Rev. 3   Проголосовать: нравится -27 Проголосовать: не нравится

MikeMirzayanov When the prize winners will be announced?

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Legend Master Farhan132

»
4 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

When and how will the certificate arrive

»
4 года назад, # |
  Проголосовать: нравится -41 Проголосовать: не нравится

I have got a message that my code has been matched with some random person who was also giving this compitition, I don't know how this happened, this might be coincident but I just want to confirm that I don't know that person nor I have any contact with him/her. Please recheck your system and consider me in this competition.

»
4 года назад, # |
  Проголосовать: нравится +11 Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

Not well, this is some kind of disrespect for the codeforces community in general — sad of course ... But if there are problems with cheating, then let us (participants) know that the results will be later, many participants are waiting for the results ...

»
4 года назад, # |
  Проголосовать: нравится +144 Проголосовать: не нравится

I apologize for the delay. And finally, with fanfare and drums, I publish the lucky ones who get the T-shirts.

List place Contest Rank Name
1 1431 1 tourist
2 1431 2 Benq
3 1431 3 Geothermal
4 1431 4 natsugiri
5 1431 5 Golovanov399
6 1431 6 eatmore
7 1431 7 xiaowuc1
8 1431 8 Bedge
9 1431 9 TadijaSebez
10 1431 10 Bench0310
11 1431 11 ainta
12 1431 12 azukun
13 1431 13 uwi
14 1431 14 wu_qing
15 1431 15 SYury
16 1431 16 Tlatoani
17 1431 17 -14
18 1431 18 majk
19 1431 19 Potassium
20 1431 20 Sugar_fan
21 1431 21 pashka
22 1431 22 Fortin
23 1431 23 htkb
24 1431 24 Aleks5d
25 1431 25 Kilani
26 1431 26 IgorSmirnov
27 1431 27 lucifer1004
28 1431 28 tob123
29 1431 28 fjuengermann
30 1431 30 pparys
31 1431 31 shilov
32 1431 32 senjougaharin
33 1431 33 Spheniscine
34 1431 34 Maksim1744
35 1431 35 Quang
36 1431 36 gafeol
37 1431 37 golions
38 1431 38 WiwiHo
39 1431 39 PugachAG
40 1431 40 ynq1242
41 1431 41 jonas.havelka.42
42 1431 42 yudedako
43 1431 43 gleb.astashkin
44 1431 44 Dart-Xeyter
45 1431 45 Ji_Kuai
46 1431 46 EmK
47 1431 47 timmyfeng
48 1431 48 receed
49 1431 49 Son
50 1431 50 Nikitosh
53 1431 52 pseuda
79 1431 79 Hakiobo
92 1431 92 0solve
98 1431 98 jvmusin
120 1431 120 Moririn2528
161 1431 161 pye
165 1431 165 ndrsh
184 1431 184 jetoyrico
199 1431 199 __v0id
232 1431 232 TToPoCeHoK
246 1431 246 manish.17
251 1431 250 Koala13
261 1431 260 htamop
265 1431 265 Dimitrys
317 1431 316 JNU_dh_AK_WF
328 1431 328 keertan
331 1431 331 jcarlson212
371 1431 371 da_louis
377 1431 377 smit.mangukiya
380 1431 380 ShSergey
392 1431 392 eneskayiklik
395 1431 395 ali.gh2236
401 1431 400 dubina
408 1431 408 Lius
424 1431 424 ScrappyDoo
449 1431 449 shubhammitt
464 1431 463 ambershogun
471 1431 471 alaza5
474 1431 474 IdeaSeeker
495 1431 495 Soul_Full_Of_Thunder
513 1431 513 ekeitaro
521 1431 516 Dorost
528 1431 528 Exiti
540 1431 540 The_Uncrowned_King
547 1431 547 reLLike
549 1431 547 FLEA
555 1431 555 B0rnToLose
572 1431 572 j00sko
593 1431 593 fkrihkl
634 1431 632 Protego_totalum
636 1431 635 haru_mizuki
648 1431 648 iff.julian
664 1431 664 BMking
665 1431 664 bansalraghav_19
666 1431 666 dvd1
700 1431 700 ztein
702 1431 702 ErimKerim
708 1431 707 Niloy.
709 1431 709 steph.dubedat
724 1431 723 algomath
  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    Wow it's definitely the best new for me in this November morning! Thank you the Codeforces Platform! Besides I have a question: how would the T-shirt be posted to prize-winner? thx for your replying

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Where is the list of the those people who have won the T-shirts. Also wanted to know where can we access the online Certificate?

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

When and how are we going to receive certificate

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Here you go.

    kotlin-heroes-logo.png

    • »
      »
      »
      4 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Not Cool dude,the fact is i thought it was real.even though title is wirtten as Hotlin. But I genuenly asked for certificate

      • »
        »
        »
        »
        4 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Sorry mate. I thought it was obvious.:D

        • »
          »
          »
          »
          »
          4 года назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          It's OK mate but seriously do you know when our certs are going to arrive

          • »
            »
            »
            »
            »
            »
            4 года назад, # ^ |
              Проголосовать: нравится 0 Проголосовать: не нравится

            I participated in Kotlin Heroes 2,3,4,5, and don't remember getting a certificate, so I don't think you get it automatically.