LilyWhite's blog

By LilyWhite, history, 3 years ago, In English

So I have a script I've written for my own use that does simple compilation jobs.

Through time, I've been adding functionalities to it, and then it occurred to me that I can publish it so others can benefit and improve it.

So I've added some sanity check and made it free (as in freedom) software on Github

Currently it has the following functions:

Arguments:
  -h | --help               Show this help
  -f | --file FILE          The file to compile, without the .cpp suffix
  -i | --input-file FILE    Feed input to your program from FILE
  -c | --compare PATH       Batch compare with data in PATH
                            This option assumes that the input and output files
                            are named name_id.in and name_id.out, where name is 
                            the argument to -f and id increases from 1
  --sanitize                Use G++ sanitize options
  --verbose                 Be more talkative
  --version                 Print version and copyright information.

Just execute the compile.sh file in the repo and that's it!

Please help me improve it and I hope that it can become more powerful through community efforts.

Note that currently some options are hardcoded, they do work for me but may not work for you:

  • It defines macro with -DLILYWHITE for debug use.
  • It compiles in C++14

Thanks!

Full text and comments »

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

By LilyWhite, history, 4 years ago, In English

This is an ancient post, but I do see a need of OI mode contests in recent actions from time to time, so maybe it’s high time we considered this again.

I think this will be beneficial for people who are preparing for OIs, whether it is CNOI mode (no realtime judge feedback) or IOI mode. Since partial scoring is really different from the current CF contests.

I think maybe Codeforces IOI Round #x can be held in parallel with the normal Codeforces Rounds.

Apart from that, it would be great to see more kinds of contests. In current CF mode contests, heavy implementation is nearly impossible given the number of problems crammed into a short timespan. While in a 5h-3 tasks IOI contest, setters can put heavy implementations in. There can be even more possibility like answer-submitting problems (you download the inputs, work out the answer in whichever way you like, and submitting the output).

Full text and comments »

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

By LilyWhite, history, 4 years ago, In English

I have a friend who is rated purple on CF but only 1700 on AtC.

So how do they really map?

Full text and comments »

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

By LilyWhite, history, 4 years ago, In English

I can usually get to C/D in contests. However, I often get stuck at As for overestimating its complexity.

Apart from this, I code really slow and buggy at A, but code way better at Cs and Ds

So what should I do to solve this interesting problem of me?

Full text and comments »

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

By LilyWhite, history, 5 years ago, In English

So I was goofing around and playing computer games during lockdown and I've came across this problem.

Imagine I am playing a text-adventure game that has $$$n$$$ stories, by going through a story I gain $$$s_i$$$ points. After a story ends, I will face some choices, each choice are marked with a score range $$$[l_i, r_i]$$$ and I can only choose it if my current score is within the range. The choices will then lead me to another story.

I am standing at the beginning which is also a story, call it story $$$0$$$, the game ends when I reach the end of one story and cannot find a choice that is open for me (i.e my score is fit for the range limit).

Question: What's the maximum score I can get given that I know the structure of the game (how the choices are placed and their requirement, and the score increases for the stories) and I play optimally?

Is this question solvable within polynomial time?

Full text and comments »

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

By LilyWhite, history, 5 years ago, In English

The virtual participation system is great. However, sometimes I want to simulate a contest more realistically, and simply testing system tests becomes a problem as some problem setters tend to have weak pretests.

So here is my solution: virtual participation will only test pretests by default, but you can still turn on system test mode. And when the participation ends, a "Run System Test" button will appear and you can run systests for your own submission, just like how TopCoder works.

Full text and comments »

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

By LilyWhite, history, 5 years ago, In English

First things first, Codeforces blog system is awesome, however recently I had found a problem with it.

Full text and comments »

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

By LilyWhite, history, 5 years ago, In English

Given a segment of length $$$1$$$, randomly pick two points $$$A$$$ and $$$B$$$, you are tasked to find the expected length of segment $$$AB$$$.

For Chinese readers, Chinese statement is here:

Chinese Statement

Someone says that it is related to the theoretical proof of Chtholly Tree, but I simply cannot understand why...

Full text and comments »

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

By LilyWhite, history, 5 years ago, In English

Suppose we have an indefinite equation about $$$x,y,z$$$.

$$$a^x+b^y=c^z$$$

If $$$(x,y,z)=(2,2,2)$$$ satisfies the equation, is there other such $$$(x,y,z)$$$ groups with $$$x,y,z \geq 2$$$ satisfy the equation?

Notice, that unlike Fermat's last theorem, $$$x,y,z$$$ does NOT have to be pairwise equal.

I think that the answer is NO, but I am unable to prove it or construct such groups. Please help me :D

Full text and comments »

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

By LilyWhite, history, 6 years ago, In English
int n;
cin>>n;
if (n==0)//deal with it
for (double i=0;i<=1/(double)n;i+=1e-9)//do something

It seems that, this code runs faster when n becomes larger...

When n = 109, the code will be executed once. When n = 1, it runs 109 times.

So I estimated it as O(n - 1).

But, this means that this algorithm runs even faster than O(1).

How is it possible?

Full text and comments »

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