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

Автор MikeMirzayanov, 6 лет назад, По-русски

Hello, Codeforces.

This is a short blog to introduce you recent updates in Testlib and Polygon.

Testlib

Generate a Permutation

Now, you can easily generate a permutation with codes like this:

Code Result
vector<int> p = rnd.perm(n); Generates 0-indexed permutation of size n
vector<int> p = rnd.perm(n, 1); Generates 1-indexed permutation of size n

Function println

Now, you can easily print space-separated lines in a generator. A println uses cout, thus prefer faster method if you print huge data.

Some examples:

Code Result
println(5); Print 5 and line break
println(1, 2, 3); Print 1 2 3 (three space separated integers) and line break
println("one", "more", 5.5); Print one more 5.5 (three space separated items) and line break
vector<int> a; ...; println(a); Print vector a (separate elements with spaces) and line break
vector<int> a; ...; println(a.begin(), a.end()); Exactly the same as above
string b[5]; ...; println(b, b + 5); Print array b (separate elements with spaces) and line break

Here is the example of a generator to print a permutation:

#include "testlib.h"

using namespace std;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);
    
    int n = atoi(argv[1]);
    println(n);
    println(rnd.perm(n, 1));
}

Function readInts and similar

Just as a reminder. Use functions readInts/readLongs/readStrictDoubles or readTokens/readLines in a validator to read and validate a sequence of values. To read a size of an array and array itself, use:

int n = inf.readInt(1, 200000, "n");
inf.readEoln();
inf.readInts(n, 1, 1000000, "a");
inf.readEoln();
inf.readEof();

Polygon

Example Problems

I've introduced three example problems. Each Polygon user has READ-access to them. Please, use them as examples how to write a problem in Polygon. They are:

  • example-a-plus-b: simple A+B problem
  • example-almost-upper-bound: simple problem to illustrate non-standard checker (always consider to use readAnswer function like in the example), generators and stress tests
  • example-interactive-binary-search: simple interactive problem on a binary search

Other Small Fixes

  • Allow to upload files (for example, images) as a contest property/file to use them in the statements.ftl. File names should start with 'statements-'.
  • API has been improved to support general description, general tutorial, tags, test groups and points.
  • Show problem ID on the summary box (on the righmost top block).
  • Replace UTF-8 typographic characters to their ASCII equivalent (for example, replace em dash — with ---).
  • Caching issue has been fixed. Previously, it could show RJ on tests even if the reason has been fixed.

Thanks to fcspartakm for implementing most features in Polygon.

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

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

cool !

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

wow :O !

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I Use it with My Visual Studio ,I think it would be awesome if we could use it with codeforces (codeforces, Visual Studio)

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I remember of D2T3 in NOI2018(National(China) Olympiad in Informatics) when I see the word "polygon"...

»
6 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Anything for java users ?? :'(

»
6 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

The problem still exists. I tested again, using your example-a-plus-b problem. I enabled tests points, set point for each test, submitted a WA solution and it scored the maximum point.

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for the platform Polygon and its updates. But I think there is some bug in the current version. I was creating a problem and uploaded some input files from my computer. When running the verification, the validator "wfval.exe" kept "expecting eoln" and "exiting with code 3" on a random line. I checked the line manually and found out that it was just a usual line in my input file... I have my own validator and it works fine. Why is there a werid "wfval.exe"...?

»
6 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

MikeMirzayanov Is everything ok with the system? When I try to submit a solution on my own problem in a group, it gives a verdict "denial of judgement". In file included from check.cpp:1:0: testlib.h:2240:42: error: 'std::true_type' has not been declared static std::string vtos(const T& t, std::true_type)