Deathly_Hallows's blog

By Deathly_Hallows, history, 5 years ago, In English

Hello,

I have spent much time on those two submissions trying to figure out what's wrong with them, so if anyone has time can you help ?

1 — 56211719

2 — 56332397

»
5 years ago, # |
  Vote: I like it +11 Vote: I do not like it

About 1187C. Seems that it's wrong union:

        while(j+1<vec2.size() && vec2[j+1].first<=vec2[j].second)
        {
            j++;
        }

You can try the following input:

10 4
1 2 6
1 3 5
1 6 9
0 1 10

The output of your code on my host is

YES
10 6 7 8 9 2 3 4 5 1 
  • »
    »
    5 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yes it is correct thank you, did you find anything about the first one ?

»
5 years ago, # |
  Vote: I like it +12 Vote: I do not like it

Looks like I found the bug in the first one:

for( j = 0; j<s.size(); ++j)
{
      if(s[j] == '.') break;
      ...
}
// here j is still an index of '.'
...
for( ;  j<s.size() ; ++j) if(s[j] != '0') {f = 0; break;} // thus f would always be false