hzyfr's blog

By hzyfr, 10 years ago, In English

Great thoughts come from daily life... XD

Two days ago my classmates(I'm a high school student) invented this easy(but difficult :p) game.. It was just after beginning of new term and they want to find something to do so they create such game imho...

And the rules are at below


Given a N*M board. Each grid contains 1 single piece

Then two players take turns to move away pieces: At each move, he can take any number of pieces in a same row or column (**NOT** necessary to be adjacent ones); The player who takes the last piece wins

Obviously there is a optimal strategy and for given M and N the result is determined(assuming optimal playing), however this is not easy to figure out. Even for small cases(like N=M=4) the game will be very complicated.

So anyone could come up for a solution?

Full text and comments »

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

By hzyfr, 10 years ago, In English

It is nearly a month before last topcoder SRM editorial was published. TCO round 3B and SRM 629/630 still has no editorial.

Why was that happening? That's just not good.

Full text and comments »

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

By hzyfr, 10 years ago, In English

It is 1 day after IOI 2014 contest. Are there any online judges for these problems? There are two interactive problems in Day 1, and I can't know if my solution is correct without special checkers.

Does anyone know any place to submit programs for IOI 2014? If you got one, please put the link below. I think a lot of people are waiting for this.

Full text and comments »

Tags ioi, 2014, oj
  • Vote: I like it
  • +21
  • Vote: I do not like it

By hzyfr, 10 years ago, In English

IPSC 2014 will take place on June 15, 11:00 UTC at here. You can compete as a team with maximum 3 persons, or as an individual participant. Individuals will also have a separate standings.

Contest rule is similar as ICPC(5 hour duration, 10~15 problems, no partial score, penalty time); it is also very different however: problem format is submit answer/ interactive problem. Each problem has two subtasks, easy worth 1pt, hard 2pts. Details are available at the official page.

Winners of last year:

Open group: tourist, Petr, ACRush

Individual group: andrewzta

Secondary school group: roosephu, xlk, jqdai0815

Full text and comments »

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

By hzyfr, 11 years ago, In English

Now we have more Div.1 contests than before! I wish in the near future more and more contests will have Div.1 version!

I still remember throughout the whole winter break there was only one div.1 contest ...

BTW what format will coder strike online version have? Will it be common for both divisions like Rockethon 2014 ?

Full text and comments »

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

By hzyfr, 11 years ago, In English

This is my source 6130336 I have thought of stack overflow and I implemented a stack but it still runtime error. I can't find any mistakes. plz help

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By hzyfr, 11 years ago, In English

Codeforces is really a good place for programmers. In the past several months I have made big progress.

Next week I'm going to participate in provincial selection contest. All problems have at least the same difficulty as div1 problem C. Half a year a later that just make no sense to me but now I can come up with some solutions to pass some subtasks.

Round #238 will be my last CF contest before the selection. I hope I will do better...Anyway thanks Codeforces very much.

So my next target is becoming grandmaster before the end of this year, hope I can achieve it!

Full text and comments »

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

By hzyfr, 11 years ago, In English

I'm learning sustainable data structures now. And I've got the main idea of it, that is to share some common data with the old versions. Now I want to implement lazy propagation on sustainable segment tree and I've got some problems.

It is no difference when I put a lazy tag on a sustainable segment tree or a normal tree. But when I want to push down the lazy tag to its children, I can't directly modify the children because old versions use the same memory and it will get WA on queries to the old versions later.

So what should I do in such cases? And I think of dynamic allocating new space for these shared part of the tree. Is it a good solution to the problem? And how to connect its subtrees so that will not use too much additional space(it should be at most O(lgn) memory allocated per action)?

For example I put a lazy tag on segment [1,8] before and now I want to push down to [1,4] && [5,8] but what will be these new nodes' children? Apparantly keep allocating is not a correct way because that may use O(n) space.

Full text and comments »

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

By hzyfr, 11 years ago, In English

As it knowns to all c++ coders, re-defining loop variable is a undefined behavior that leads to a unexpected result of your program, or sometimes Runtime error.

This often happens when you want to write a long loop statement:


for(int i = 0; i <= n; ++i) { //do something very complicated for(int i = 0; i <= m; ++i) { ...... } }

Usually after you use the outer loop variable i to do something, the variable i become useless, but you want to do other works inside the loop , and you forget that you have defined i outside.

Then when you run your program you will find something strange happens. Maybe the program never stops or the program enters the first loop and only run one time then stops. I think most of the coders have such experience. Also this bug is not easy to discover(though fixing it is really simple work).

However this error can easily be detected by compilers, if it check every definitions inside a loop that defines temporary loop variable(s). I would say that if the compiler does that work and give us a warning then it will not be a disgusted, hard-to-find bug anymore. So I really hope the compilers will support such a feature in the near future.

Full text and comments »

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

By hzyfr, 11 years ago, In English

I got pretest passed on problem B just before the contest ends ! I was working on C but I didn't came out a solution so I turned to B. Soon I know this problem can be solved using binary search with heap optimization. I finished coding on 1:48 but it was wrong. Then I found a minor mistake of the indices. So I fixed the program but got WA1. And suddenly I found my program outputs 'yes' instead of 'YES'. Well the second submission was successful! hope my solution will pass system tests (It works in O(nlog^2n)) If only I had worked on prob.B earlier.. I would get about 200 more points

Full text and comments »

  • Vote: I like it
  • -20
  • Vote: I do not like it

By hzyfr, 11 years ago, In English

I hope someone could tell me about the details, or give me a link for the tutorial. Thx

Full text and comments »

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