Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

Блог пользователя tiger2005

Автор tiger2005, история, 3 месяца назад, По-английски

CPLib is a library written in C++ for processing test data of competitive programming problems. It helps you write clear and efficient checkers, interactors, validators, and generators. CPLib uses "variable input template" as its major feature, provides friendly feedback for humans and backends, and is working hard to reach better compatibility and efficiency.

You can get CPLib from Github Repository. The "single-header-snapshot" branch automatically updates single-header version of CPLib which is easy to use. Also, you can visit cplib.vercel.app for more information. For regex-related questions, please refer to the FAQ page.

Here is a basic example of a checker using CPLib. For more examples, visit the links above.

#include "cplib.hpp"
 
using namespace cplib;
 
CPLIB_REGISTER_CHECKER(chk);
 
void checker_main() {
  auto var_ans = var::i32("ans", -2000, 2000);
 
  int ouf_output = chk.ouf.read(var_ans);
  int ans_output = chk.ans.read(var_ans);
 
  if (ouf_output != ans_output) {
    chk.quit_wa(format("Expected %d, got %d", ans_output, ouf_output));
  }
 
  chk.quit_ac();
}

The project is mainly written by yzy1, and I, tiger2005, work on syntax designs and some tiny stuffs. The project is still under development, so feel free to make suggestions!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +161
  • Проголосовать: не нравится

Автор tiger2005, история, 14 месяцев назад, По-английски

( My English is poor, and the blog might be a little confusing :( )

If you use Sublime Text for competitive programming, you shouldn't miss the extension called FastOlympicCoding. You can see more from its repository. The extension will create a single file containing the test cases for each code file, and you can run it easily with a key combination.

Also, Competitive Companion is a nice extension for competitive programming website. it will parse the test cases in the current website and send it to your code editors by POST requests.

Unfortunately, FastOlympicCoding cannot link with this extension. When I tried to find out how to link them, I clicked into a repository called FastOlympicCodingHook. The extension works as following: When you right click at a file and select Listen to Competitive Companion, a local server will be started to handle the POST requests from Competitive Companion. A file of test cases will be generated by the server, and you can test your code by FastOlympicCoding.

The extension is great but not convenient for me, as I needed to do several actions to make my test cases ready. So I did some modifies to the source code and finally I succeeded in making my own FastOlympicCodingHook. The server part works the same as the original one, but after selecting a template file and a problem directory, the new extension can generate code files along with test cases files automatically.

The extension worked greatly in some coders' computers, but as I'm not good at writing python code, I'm not sure if there's any bug in the extension. I hope someone can make a better extension and make the bridge between Sublime Text and Competitive Companion stronger.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +26
  • Проголосовать: не нравится

Автор tiger2005, история, 3 года назад, По-английски

Is Codeforces' page redirection temporary?

It does is a way to get rid of web crawlers, but it makes CF Tool unusable. If you try to do any operation in CF Tool, you can only get "Not logged in" and "cannot find csrf" message. Same things happens on "Codeforces Contest Helper" developed by myself, so I can explain why.

CF Tool fetches the website page before each operation, so that it can know if you are logged out by searching for your username in the element ".lang-chooser" (Look at the upper right corner of this page and you'll know why). Also, Codeforces uses csrf-token to verify if you are a humen. These tokens are generated randomly when you open a new Codeforces page, and they're attached to verify every request on this page. CF Tool also needs this token for further operations, so it will get the token from the website page by regex.

If you are lucky to copy the redirect page source, you can see that there is no ".lang-chooser" and "Csrf-Token" any more. Thus, CF Tool thought that you are not logged in, but when it tried to get csrf-token to log in, it cannot get csrf-token and eventually fail.

I thought that projects like CF Tool can more or less solve the problems about slow Internet. I'm from China, and I can tell that most of Chinese CP lovers need to wait for a long time if they want to check out the standing lists, view problems and submit solutions. As a way to avoid loading unnecessary resources (just like css file, js file, font file, etc.), CF Tool really helps us.

So, back to the main question, I really want to know when the page redirection can be closed. As a coder, I hopes to get lower penalties by CF Tool. As a developer, I need to test new features I've made.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +126
  • Проголосовать: не нравится

Автор tiger2005, история, 3 года назад, По-английски

As you can see, Codeforces doesn't provide real rating, and we can only use the length of rating changes to calculate the real rating. The official blog wrote that CF rating calculator uses real rating to calculate rating changes, that is, we should get all people's real ratings to predict the rating changes. But method user.rating of Codeforces API can only get ONE account's rating changes in one attempt, so it's quite hard to do it. Hope Codeforces API can add realRating into User object :)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +122
  • Проголосовать: не нравится

Автор tiger2005, история, 3 года назад, По-английски

The help page writes that API can return a BlogEntry object in full version, that is, the content of the blog will be returned. But when I use this method,I found that a short version of a BlogEntry is returned. So is it a feature? How can I get full blog information using API?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится