hloya_ygrt's blog

By hloya_ygrt, history, 7 years ago, translation, In English

Hello CodeForces Community!

After serving the lip smacking August Long Challenge, CodeChef is back with August Cook-Off 2017 (https://www.codechef.com/COOK85)! Hop on for five challenging problems and 2.5 hours of rigorous programming!

Joining me on the problem setting panel are:

  • Problem Setters: Melnik (Daniil Melnichenko) and hloya_ygrt (Yura Shilyaev)
  • Problem Tester: kingofnumbers (Hasan Jaddouh)
  • Admin: kingofnumbers (Hasan Jaddouh)
  • Editorialist: Melnik (Daniil Melnichenko) and hloya_ygrt (Yura Shilyaev)
  • Russian Translator: Melnik (Daniil Melnichenko) and hloya_ygrt (Yura Shilyaev)
  • Mandarin Translator: huzecong (Hu Zecong)
  • Vietnamese Translator: VNOI Team
  • Language Verifier: (Priyank jaini)

I hope you will enjoy solving them. Please give your feedback on the problem set in the comments below, after the contest.

Now, without further ado, please allow me to share the contest details with you real quick:

Time: 20th August 2017 (2130 hrs) to 21st August 2017 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone.

Details: https://www.codechef.com/COOK85

Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.

Prizes: * Top 10 performers in Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://www.codechef.com/laddu. (For those who have not yet got their previous winning, please send an email to [email protected])

Good Luck! Hope to see you participating!!

  • Vote: I like it
  • +80
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The contest has just started!

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

What is wrong in my approach for B ?

int a = Math.min(A , B);
int b = Math.max(A , B);

int minor = Math.min(b - a , k - (b - a));
long ans = 0;
if(!(k % 2 == 0 && b - a == k / 2)) {
    ans += minor - 1;
    ans += 1L * (k / 2 - minor - (k % 2 == 0 ? 1 : 0)) * 2;
}
 println(ans);

Basically I am checking if a and b are in the diameter , if they are not then I'm adding all points in the minor arc . For the major arc I am finding the point which subtends 90 degree at a or b . This point should be at the other side of diameter from a or b .

  • »
    »
    7 years ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    I think you shouldn't be counting any points on the major arc. The answer is just minor-1.

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Why is it so ? , The obtuse angle can be at vertex A or B right ?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it +8 Vote: I do not like it

        FML I thought that the triangle should be obtuse :(

  • »
    »
    7 years ago, # ^ |
    Rev. 4   Vote: I like it +10 Vote: I do not like it

    It is this simple.

        int k, a, b;
        scanf("%d %d %d", &k, &a, &b);
        int d1 = abs(a - b);
        int d2 = k - d1;
        int ans = 0;
        if (2 * d1 < k) {
          ans += d1 - 1;
        }
        if (2 * d2 < k) {
          ans += d2 - 1;
        }
        printf("%d\n", ans);
    
»
7 years ago, # |
  Vote: I like it +3 Vote: I do not like it

How to solve that game problem ?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Is it possible to see the tests on Codechef?

»
7 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Hint for Tree Connectivity?

  • »
    »
    7 years ago, # ^ |
    Rev. 4   Vote: I like it +18 Vote: I do not like it

    Iterate over the vertices in order of their labels, and use a lazy segment tree to determine the number of possible R's for a certain L. In my opinion, this was much easier than "Game on a Stick."

    • »
      »
      »
      7 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      How to determine the number of possible R's for a certain L? Can you explain little bit more?

      • »
        »
        »
        »
        7 years ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        As mentioned in the editorial, keep track of the number of missing edges for each R value.

»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

I think this is the First Cook off to get above 3000 participants ! Wow!