Блог пользователя den2204

Автор den2204, история, 8 лет назад, По-русски
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Разбор задач Codeforces Round 532 (Div. 2)
  • Проголосовать: нравится
  • +69
  • Проголосовать: не нравится

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

Auto comment: topic has been translated by den2204 (original revision, translated revision, compare)

»
8 лет назад, скрыть # |
 
Проголосовать: нравится -111 Проголосовать: не нравится

this wouldn't have been needed if you gave us actually useful good problems.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится -31 Проголосовать: не нравится

why so short solution for D , please elabprate what u r saying den2204

  • »
    »
    8 лет назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +12 Проголосовать: не нравится

    For D,

    Let us solve this question assuming that the king is at the centre of the board at (500, 500). (If it is not at the centre, then we need around at max 499 steps to reach it as it could have been at the corner.)

    Once you are at the centre, consider the four newly created divisions (or quadrants) of the board. Choose the 3 divisions which do not have the minimum number of rooks. By doing this you ensure that the combination of these 3 divisions has atleast 666 * 3/4 >= 499 rooks otherwise you have not chosen the top 3 divisions correctly (basic pigeon hole principle).

    From now, just move the king away from the section with the minimum rooks ( < 499 in any case) along the diagonal (this ensures that rows and cols are handled together).

    Keep doing this till the corner. You are bound to get a check by a rook as no. of steps required to reach corner from the centre is 499 and from php we know that there are atleast 499 rooks there.

    Eg. 1. king at 999,999

    1. move king to 500,500

    2. let quadrant IV have minimum rooks (167). So quads I, II, III have 499 rooks combined.

    3. while going towards 0,0 (top left point inside quad II), we will end up checking from rows 500 to 1 and cols 500 to 1 simultaneously while going towards the top left diagonal.

    4. since no. of steps to reach the diagonal is at max 499 and we know that there are 499 rooks in these 3 quads, we will get a check(mate) for sure.

    NOTE: I may be off with the numbers by 1 or 2..but i hope you get the point. All of this will occur in less than 1000 steps

    A good question it sure is.

    • »
      »
      »
      8 лет назад, скрыть # ^ |
      ← Rev. 2  
      Проголосовать: нравится +3 Проголосовать: не нравится

      There is one corner case you need to handle, which is if rooks are on the king's diagonals. You will need to go the nearest row and col together to eliminate the rook as you cannot eat it. I'll fix and share a code with good comments soon

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

F can be solved in O((n + q)logC).

Code: https://codeforces.me/contest/1100/submission/48345032

System tests for D are too weak. My submission that moves king to the center and then allways moves it to the same corner passed system test.

Code: https://codeforces.me/contest/1100/submission/48362464

»
8 лет назад, скрыть # |
← Rev. 8  
Проголосовать: нравится +48 Проголосовать: не нравится

Good Explanation for C Captu2re

the Radius of the innar circle = R and radius of the outer circle = r by connect the center point of the innar circle with two center points of the other consective small circles , the angle (a) = 360 / n and the traingle is Isosceles triangle from the cousine law we will reach Untitled-1

#include "bits/stdc++.h"
using namespace std;
const long double PI = acos(-1);
int main()
{
  int n , R;
  cin>>n>>R;
  cout<<fixed<<setprecision(7)<<sin(PI / n) / (1 &mdash; sin(PI / n));
}

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

http://codeforces.me/contest/1100/submission/48402367

why D is falling? I just can not understand, plz help

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -9 Проголосовать: не нравится

I think, author's solution for D is wrong. For example, put the king to the center, put 333 rooks to positions 1 1, 2 2, 3 3,... 333 333, and other 333 rooks to positions 999 999, 998 998, 997 997,... In such case the king has no chance to win.

I tried to find additional restrictions in the task, excluding such an example, but don't see it. Am I wrong?

UPD: Thank you, guys, you are right

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

D question was very good! Very good effort on your first contest as author.

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Could somebody explain the time complexity of the hull method in F please?

I am seeing a O((nlog(n) + q)log2C) time complexity, with the recurrence

T(n) = O(n)log2C + T(n / 2) + T(n / 2)
»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

An International Grandmater(djq_cpp,He is only 13!!!!) told me there are answer code for problem F on the Internet.I copy the code and get accepted(I didn't take part in the contest.).So F is a problem appeared before.That's really bad!!!Submittion 48412606

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

Если следовать описанному алгоритму для D, можно нарваться на то, что король побьет ладью. Подозреваю претесты тоже эту ситуацию не хендлят

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -26 Проголосовать: не нравится
»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Why first solution fails and second one passes for E?

First solution
Second solution
»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In ques E,i am getting wrong answer on test case 7 but am not able to identify the problem in my code.Can somebody help me with it please?

link : https://codeforces.me/contest/1100/submission/48427349

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

Can anyone explain B plz. If possible give your code too xD

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

If I return 1 at the end of interaction I will get Runtime Error. Had many RE because of that!

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

How to implement E? Any suggestions? Thanks in advance

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

48427795 Could anyone help me with prob E. My solution is an implementation of the tutorial, however I get a TLE for test case 10. Many thanks in advance.

»
8 лет назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

For E, can someone explain what i'm doing wrong.

  1. I binary search on K(max edge wt to be removed) as given in the editorial. Find appropriate K.
  2. To construct graph remove all edges having wt <= K.

code For 3rd tc, K is correct but it contains cycle if i remove edges by above rule.

I did this because here it says reversing an edge is same as removing in directed graph.

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

Can someone please explain or link me to what is being done with the hulls , and what are hulls ? Is it related to the convex hull or something related to do? Thanks

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

    a set of number which is linearly independent in xor? that is,you can make a linear hull using some numbers, and using the numbers in the linear hull, you can get every number which you can get with the original numbers by xor

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

In problem E, after finding the min value of k using binary search how to determine which edges to be reversed. For example-

3 3
1 2 10
2 3 10
3 1 10

This will give me the k = 10 but how to determine which edge to remove.I was thinking of removing all the edges with val<=k. But the above test case will pose the problem , that the graph will become disconnected.Help please.

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

why the solution 2 for F is O(nlog2C + q)? I think it should be O((n + q)logC) or did I misunderstand it? here is my solution

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

I have another way to solve B.

If we list the positions of every difficulty in n lines such as :

1: 3 11
2: 1 4 5 6 8 9
3: 2 7 10
(the first example)

we can easily find that a round will be held when p - th problem is put into the pool, where p is the maximal number in each column. (In the example above, they're 3 and 11.) So we can denote cnt[i] as the number of problems in difficulty i and f[i] as the maximal number in i-th column and then do f[++cnt[a[i]]] = i. Because the position i is increasing, f[j] is the maximal number. Print 1 if any f[j] (j ≤ min(cnt[k])) equals to i, otherwise print 0. The complexity is also O(m).

»
8 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Update: I understood the problem incorrectly. I thought that the king must stay checked after a rook moves. Not sure why. So my example is an instantaneous win for the king.

[It seems to me that the proposed solution to D is incorrect. Consider 5x5 board with 3 rooks and the king located like this (X for a blank):

RXXXX
XXXRX
XXKXX
XXXXX
XXXXR

Here we have 3 rooks and the king needs (sort of) 2 steps to reach the corner. However, considering that we can't take the rook at the first step — it is impossible to win. If we go right-up or up-right it is easy to see that all rooks can escape.

Now you can create a configuration on 999x999 board where 500 rooks are placed in 3 quadrants such that this bad case will occur when the king is 2 steps away from the corner (and blocked by the rook). And you can easily place other 497 rooks such they will escape one by one as the king moves diagonally from the field (500, 500).

Did I miss something?]

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