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

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

Hi, I am eager to know How to Find the Optimal Strategy When First See a Game Problem?

For example, CodeTON #2 Problem F Colouring Game, how do you know "start by taking RB/BR parts" is the smartest move, before you see the editorial?

Полный текст и комментарии »

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

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

When I do construction problems, I am always unable to find the entrance from which I can find the solution in the tutorial. It seems to me that the tutorial methods are just 无中生有(created out of thin air). How can I find them too?

Полный текст и комментарии »

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

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

Hello everyone! After endless debugging, I finally got AC on all the samples and submitted my code of F — Bear and Chemistry. However, it got Wrong Answer on test #63(which is not a hack, but a big case with n=300000,m=300000,q=100000!), and there are 77 testcases in all(which means I have passed a major part of them)!

I am pretty exhausted now. I wonder if any one of you experienced programmers can share with your approach in tackling this kind of thing. I would be most grateful!

Note: Don't get me wrong, I was not asking for you to debug my code.

Полный текст и комментарии »

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

Автор pengyule, 3 года назад, По-английски

Hi CF users. Me is needing help with CF1530F Bingo.

In fact, my solution is able to pass the first two samples, but WAs on the third where $$$n\ge 3$$$.

Yet I am not able to find a mistake in my method, which is narrated as follows:

  • Consider two cases: there is a row all-1 and there isn't one.
  • For the 1st case: brute force the mask of the all-1 rows, and calculate the Product possibility of all selected nodes.
  • For the 2nd case: Consider diagonals as columns; so there are $$$n+2$$$ columns. Dfs the mask of the all-1 columns, so for each row i we are able to calculate the $$$Product$$$ of $$$p[i][j]$$$ for those $$$(i,j)$$$ that are undetermined; the product of all $$$(1-Product)$$$ should be the possibility of "at least a column is all-1 and no row is all-1".

This is my code. Will you help me?

Полный текст и комментарии »

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

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

As known, there is a "smart_indent" option in Sublime Text. However I have recently found this intent option un-smart when I wanted to change the style of indentation.

E.g., when I type a

for(int i=1;i<=n;i++)
    cin>>a[i];

I'd prefer

for(int i=1;i<=n;i++)cin>>a[i];

But the "smart_indent" option would do this↓ when I change into my preference of the sentence:

for(int i=1;i<=n;i++)cin>>a[i];
    int x;

I mean it would still insert a tab when I press "Enter". Worse yet, if I backspaced that tab and finish the second line and press enter again, the third line would backspace a tab automatically.

That's really annoying isn't it, so I switched off the smart_indent option, wishing it would no longer produce that tab.

However, things get worse. Nothing would happen when I enter the second line, but a tab would still be backspaced on the third line!

Confused, I came here for advice: What should I do?

Полный текст и комментарии »

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

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

Hi. The tutorial said that the total time complexity of the solution is $$$O(n^2)$$$, but there seems to be 2 layers of "for"s in each turn of "dfs", which seems to be $$$O(n^3)$$$. Though it must be less than $$$O(n^3)$$$, could anyone please analyse detailedly of the problem? THX!

Полный текст и комментарии »

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

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

My first solved-problem on Codeforces.

It's really an easy problem.

As we know, if you want to make the a and b as small as possible, they must only contain digits 0 and 1.

So, we have the thinking in the following:

  1. if the digit of x[i] is 2: we try to make a[i] and b[i] both 1.
  2. if the digit of x[i] is 0: we try to make a[i] and b[i] both 0.
  3. if the digit of x[i] is 1: either a[i] or b[i] would be 1. We'll make a[i] 1 because it is no difference if we make b[i] 1.

However, if we make a[i] 1, the number a must be larger than b as a fact.

So, we would not want to make array a still bigger. So after we make a[i] 1, we have different thinking:

  1. if the digit of x[i] is 2: we make a[i] 0 and b[i] 2.
  2. if the digit of x[i] is 0: we make a[i] and b[i] both 0.
  3. if the digit of x[i] is 1: we make a[i] 0 and b[i] 1.

That's all. We'll discover that after we make a[i] 1, a does not increase anymore, but b is increasing, however it will never be bigger than a.

Thanks for reading, hope that'll help you!

Полный текст и комментарии »

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