Hello everyone! I've written a script in emacs lisp, that can:
- Submit solution
- Download tests
- Enter by handle/password
- Store cookies between runs
All the requests are made using curl
. link.
Installation
- Download script.
- Insert to your
~/.emacs
file the following code:
(add-to-list 'load-path "/folder/containing/script/")
(load "cf-keys.el")
Using
C-c i
— Log inC-c o
— Log outC-c w
— Get your current handleC-c s
— Submit currently open fileC-c d
— Save tests to current folder
Submit and save functions "guess" the contest number, problem index and the programming language by the current file name in one of the following forms:
directory/505/A/myfile.cpp
directory/505/a.c
directory/505a.cc
Setup
In your ~/.emacs
file you can change the default variable values:
cf-default-language
— Default language. Can be one of the values defined incf-languages.el
cf-host
— "codeforces.ru" or "codeforces.com"cf-cookies-file
— File, in whichcurl
will store cookies
Example: (setq cf-cookies-file "/home/vasya/my_codeforces_cookies")
Keybindings can be changed at the end of the file cf-keys.el
.
I've did what you wrote here in emacs everything seems all right (i.e. login, logout, downloading tests, current handle) except that submitting current file don't work, it also gives me submit success.
I'd be thankful if you'd help me :)
What problem have you been trying to submit? Can I see the source? What is the path to your file?
i was submitting problem 540E, the path was 540/E.cpp, what do you mean by source?
I mean the source code of solution you failed to submit. There can be some characters that I forgot to escape when passing to curl.
it's the same as this submission i was trying the parser for first time then. Do it work with you nowdays ? Have you tried submitting any solution with it about this week ?
It turns out that when you submit your solution, codeforces redirects you to the page with warning on using "%lld". Please, use "%I64d") Actually, the message "submit: ok" means that
curl
was successfully executed, there is no guarantee that the soluton is submitted. There is a lot to fix in the script.