### MikeMirzayanov's blog

By MikeMirzayanov, 15 months ago, translation, ,

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

int n = inf.readInt(1, 200000, "n");


# 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

 » 15 months ago, # |   0 cool !
 » 15 months ago, # |   0 wow :O !
 » 15 months ago, # |   0 I Use it with My Visual Studio ,I think it would be awesome if we could use it with codeforces (codeforces, Visual Studio)
 » 15 months ago, # |   0 I remember of D2T3 in NOI2018(National(China) Olympiad in Informatics) when I see the word "polygon"...
•  » » 15 months ago, # ^ |   +1 It's you! Creepy elevator!
 » 15 months ago, # |   +5 Anything for java users ?? :'(
•  » » 15 months ago, # ^ |   0 +++
 » 15 months ago, # |   +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.
•  » » 15 months ago, # ^ |   0 try to activate the checkbox "enable groups" and then appoint the first group to the first test, the second group to the second test and so on.
•  » » 15 months ago, # ^ |   0 Fixed, will be released soon.
 » 15 months ago, # |   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"...?
•  » » 15 months ago, # ^ |   0 Might it be due to different line ending characters?
•  » » 15 months ago, # ^ |   0 Please, take a look in PMs.
•  » » 15 months ago, # ^ |   0 Fixed now. You need to update testlib.h in a problem to fix it. The easiest way is to check and uncheck back an "Auto-update" checkbox.
•  » » » 15 months ago, # ^ |   +12 Thank you!! I updated testlib.h and my problem passed the verification just now.
 » 15 months ago, # |   +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)
•  » » 15 months ago, # ^ |   0 Fixing now