generic_placeholder_name's blog

By generic_placeholder_name, history, 20 months ago, In English

In this contest, while I was browsing through FST submissions, I encountered many TLEs on test 8 in B. Here are some examples: 142848311, 142836654. The solutions appeared to be completely correct. What happened here?

The problem was that these contestants used memset before every test. If you didn't know, memset(a, 0, sizeof(a)) is linear in the size of the array a.

This is why these contestant TLEd. Every testcase, they did $$$1000000$$$ unnecessary operations.

The lesson here? Stop using memset to reset stuff when there are many testcases. Resetting by hand works just fine. Or know how memset actually works, so that you don't TLE.

Full text and comments »

By generic_placeholder_name, history, 2 years ago, In English

During the Vietnamese team's participation in APIO 2021, we had a large submission queue during our last 2 or so hours, which made it impossible to get the verdict of our submissions.

For me in particular, and for many people in my team, this directly resulted in a big loss of points. For me, I lost 23 points in problem 2 due to an array bounds bug and 31 points in problem 3 due to a bug in subtask 2 (my code for 3 and 4 was correct, but I put it after subtask 2.) These bugs would probably have been fixable had I been able to see the results of my submissions.

The organizers did give us 30 more minutes, but during that time the queue was still blocked anyway.

I am aware that very little can be done at this point on the part of the APIO organizers, but I am still posting this to make people aware of this issue that we encountered. Hopefully there will be something that the organizers can do so that we could have a better experience.

Full text and comments »

By generic_placeholder_name, history, 3 years ago, In English

I am pretty sure that during Educational Codeforces Round 100 (Rated for Div. 2), buihoatpt2k3 copied code from huyhoangk36chv.

buihoatpt2k3's behavior is quite suspicious in general — he (?) submitted all his code during the last 30 minutes, and his code is heavily obfuscated.

We see, however, that after running the preprocessor (gcc -E) on the code, we get code that is strikingly similar to that of huyhoangk36chv.

For example, take 1463A - Dungeon. Here's huyhoangk36chv's code: 101515478. And here's the de-obfuscated code from buihoatpt2k3: 101775980.

Same deal for problem D: 101562763, 101776426.

I think this is pretty good evidence that these users cheated and copied code from each other, and as such, call for their participation in the contest to be voided.

Full text and comments »

By generic_placeholder_name, history, 5 years ago, In English

I am trying to submit a code on Codeforces, but I always get compilation errors. My computer does just fine. Here is the code:

var s, tmp: ansistring;
        i, j, c: integer;

function elim(var s: ansistring): ansistring;

var i: integer;
for i:=1 to length(s) do
        if s[i]='(' then elim:=elim+s[i]
        else if elim[length(elim)]='(' then delete(elim, length(elim), 1);

readln(s); tmp:=elim(s); c:=0;
if (tmp<>'((') and (tmp<>'))') then writeln(0)
else if tmp='((' then
        i:=0; s:=s+'0';
        while (s[i+1]='(') and (s[i+2]=')') do i:=i+2;
        for j:=i+2 to length(s) do
                if s[j]='(' then c:=c+1;
else begin
        i:=length(s)+1; s:='0'+s;
        while (s[i-2]='(') and (s[i-1]=')') do i:=i-2;
        for j:=i-2 downto 1 do
                if s[j]=')' then c:=c+1;

And here are the comp errors:

Invocation failed [COMPILATION_ERROR]
Can't compile file:
Target OS: Win32 for i386
Compiling program.pas
program.pas(11,36) Error: Operator is not overloaded: "elim(var AnsiString):AnsiString;" + "Char"
program.pas(12,22) Error: Illegal qualifier
program.pas(12,22) Error: Type mismatch
program.pas(12,58) Error: Type mismatch
program.pas(34,4) Fatal: There were 4 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\Programs\FPC\bin\i386-Win32\ppc386.exe returned an error exitcode

It seems that Codeforces' FPC does not allow adding char and string. How do I resolve this?

P.S. I use FPC 3.0.4.

Full text and comments »