MikeMirzayanov's blog

By MikeMirzayanov, 13 years ago, translation, In English

Hello!

This contest has been prepared by Artem Rakhov and other participants of Petrozavodsk Training Camp from Saratov State University. We stopped solving problems of the camp, missed the lecture by Vitaly Goldstein (do not be angry, Vitaly), but the round has been prepared and we are waiting for you - the participants.

Happy hacking,
MikeMirzayanov and team Codeforces

UPD:

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

| Write comment?
13 years ago, # |
  Vote: I like it +4 Vote: I do not like it
Thanks for the nice problem C
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
What is final test 16 for B?
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    you can see(or will can some later) tests by clicking to ID in "My submissions"
    • 13 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it
      It is so strange:


      Test: #16, time: 50 ms., memory: 2688 KB, exit code: 0, checker exit code: 2, verdict: WRONG_ANSWER
      Input
      509149
      Output
      1
      Answer
      509149 1
      Checker Log
      wrong output format Not sorted and uniqued

      What's wrong with this answer? It is looks like all is ok (sorted and unique)
13 years ago, # |
  Vote: I like it +5 Vote: I do not like it
Can someone please explain the solution for problem E?
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Can any one explain the logic behind problem C ?
  • 13 years ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it
    For every tree check how long will first and last trees be if current(We will name this height - len) tree is unchanged. If it greater 0 increase a[len]
    Answer is n-max(a[len])
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I think u need 1 more revision...

      I think u missed a "be" after "last trees"  ...


      and what is len?

  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Fixed the height of the first tree all the others are defined.

    So, for each tree you check which height of the first tree would keep it unchanged.

    Choose for the first tree the height that satisfies more trees.
13 years ago, # |
  Vote: I like it +3 Vote: I do not like it
Are there going to be more competitions soon?
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
All of my accepted solutions gave runtime error in the final testing :(

Please tell my error...

And my solution for C got WA for pretest 6. I used the same algorithm as above.
  • 13 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
    In Problem A you use array a with size 100 --> char a[100]
    but you must use char a[101], because the maximum length of string is 100 and the end of this string must fill by 0.
    sorry for my poor english.
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      ah great... an extremely stupid mistake to make... any idea about B?
      • 13 years ago, # ^ |
          Vote: I like it +3 Vote: I do not like it
        you must initialize the arry a with false. like this:
        memset (a, false, sizeof a);
        because your array is local and maybe not have false value. therefore the primes are incorrect and maybe have 0 value or no primes have value greater than n.
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Problem A: try to put a[101],because strlen("dejap") = 5, and you string is 0..4. So when there is a word of 100 chars your array cant access a[100] because it contains only 0..99.
    Problem B: try to declare arrays out of main function (global)
    Hope it helped.
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      How will declaring arrays out of the main function help? I haven't tried it out yet but still... how should that make a difference?
      • 13 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        Sometimes when there are big arrays in functions it generates stack overflow... It is better to declare static array which is initially filled with zeros. So it is safer. My compiler cant even compile your code until I put that 1M array out of main.
        Hope it helped. :) 
        • 13 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it
          Thanks... the solution passed!
          • 13 years ago, # ^ |
              Vote: I like it 0 Vote: I do not like it
            I am happy to help you, I learned that five days ago on some other competition.
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    In problem B u r trying for a loop of O(10^12) thats an  obvious reason for crashing ur program.
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      The time complexity of my program is O(nlogn). The sieve (the only thing which you could be talking about) has complexity of O(nlogn).
13 years ago, # |
  Vote: I like it +3 Vote: I do not like it
Who can explain the main idea to solve E?
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it

goh tu in emtehanu!

  • 13 years ago, # ^ |
    Rev. 3   Vote: I like it +2 Vote: I do not like it
    khob una Parsi nemifahman , ma ke mifahmim.
    • 13 years ago, # ^ |
        Vote: I like it +3 Vote: I do not like it
      mikhastam bebinam chan nafar irani darim!
      • 13 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it
        There are lots of us.
        خیلی زیادیم

        • 13 years ago, # ^ |
            Vote: I like it +3 Vote: I do not like it
          می تونم اگه بخواین لیست ایرانی ها رو براتون بفرستم
          • 13 years ago, # ^ |
            Rev. 2   Vote: I like it 0 Vote: I do not like it
            خیلی کار خوبیه
            دستتون درد نکنه
            فقط لطفا اینجا وسط کامنتها نذارید
            تو قسمت بلاگ بنویسید
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
No contests coming up soon?