mezhaka's blog

By mezhaka, 13 years ago, In English
I have written a little GreaseMonkey script for the automatic generation of the stub program with test cases. It works in Firefox if you install GreaseMonkey plugin or in Chrome (out of the box). The script modifies the problem description page and appends the source of the program to the bottom of the page, so you can copy-paste it into your favorite editor.

Implement your solution in the TheSolution function. Use input and output variables instead of the cin and cout in the TheSolution function.

Feel free to post any comments and bug reports. I can implement it for the other programming languages, if you sent me a suitable template.

You can install it from here: http://userscripts.org/scripts/show/117771 (click on the green Install button to the right).

UPDATE 12.01.2012
Updated the script. Now it works with a changed HTML of the site.
  • Vote: I like it
  • +12
  • Vote: I do not like it

| Write comment?
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
I don't understand how it should be used: I installed (it says it is installed) but when I go to a problem's page like http://www.codeforces.com/contest/126/problem/A I don't see anything new at the bottom...
Am I missing something? Thanks in advance :)
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Hmm... You should see the generated code at the bottom of the page... Perhaps the problem is that you have www in your adress and this doesn't match the pattern, that the script is adjusted for. Could you try http://codeforces.me/contest/126/problem/A instead? If it works, than this is the problem and let me know -- I would then update the script and add the pattern with www.
    • 13 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it
      Yes, now it works!
      Awesome job, dude :)

      It would be nice to allow template editing ;)
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
This is amazing, thanks and good job! I'm just wondering if this doesn't break any rule, like obfuscation or using too much unused code. Could someone clarify this? Thanks.
  • 13 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    I don't think you have to send the testing code along with your program, so the "unused code" won't be sent. Maybe this script will give an advantage to who use it (one-click testing) but this happens normally on TopCoder so we shouldn't worry about that.
13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
It seems the layout has changed and it does not work now. Hope you'll read it now, so you won't be surprised during the following round. Meanwhile I'll try to come up with a fix.
  • 13 years ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    Hello,I feel it very useful on coding.However if the sample input and output can be terminated by '\n',there will be much more better.

    Because I always got "not ok",and i find my solution always add extra '\n'.
    Although the presentation format have no effect on the answer,I hope to get a better usage~~ Thanks. 
»
13 years ago, # |
  Vote: I like it +1 Vote: I do not like it
Hi, cool thing.
But there is another unsignificant bug in url patterns:
// @include        http://codeforces./problemset/problem/*/*
// @include        http://www.codeforces./problemset/problem/*/*