McDic's blog

By McDic, history, 11 months ago,

Hello! I hope all of you enjoyed my contest!

Behind story of A:

• I tried to make the easiest Div2A ever. Will it work? :)

Behind story of B:

• I tried to block various heuristics. There were some critical heuristics which could pass so many cases. Fortunately I blocked them during testing period, so I hope there won't be much FST this time.

Behind story of D2C/D1A:

• Originally, there was a different problem for this position. But it used XOR. As I made new D2E/D1C problem, I threw old D2C/D1A away and put this.

Behind story of D2D/D1B:

• This problem is the most popular problem among testers. I also like this problem a lot.

Behind story of D2E/D1C:

• Feedback for this problem was too different by testers.
• I made this problem by modifying Number Discovery, which is one of my previous problems.
• If you OEIS this, then you may find you can use Nimber Arithmetic to solve this.

Behind story of D1D:

• This problem was supposed to be D2E at first. But all LGM testers failed this problem during VC, so we thought that this problem's difficulty is high. Meanwhile, I found that old D1D problem can be easily googled, so we removed that problem, push this problem to be D1D, and made another D1C problem. I will share old D1D later.

Behind story of D1E:

• Thanks tzuyu_chou for writing this problem. She is genius in both singing and problemsolving.

• +346

By McDic, history, 11 months ago,

내가 돌아왔다! (Hello, Codeforces!)

I am thrilled to introduce you to Codeforces Round #633. Followings are basic information:

• This contest will take place on 12.04.2020 17:05 (Московское время).
• The round is rated for all participants who can understand this announcement. There will be two divisions.
• There are 5 problems in each division and you will have 2 hours to solve it.
• Score distribution will be announced later.

Followings are contributors:

Followings are some fun things:

• antontrygubO_o is the most intense coordinator I have ever met. He rejected lots of my problems. Some example of rejection comments are below:
• This problem is too standard.
• This problem is appeared in recent ptz camp with higher constraints.
• I don't like it.
• Rock Scissor Paper makes statement messy, because some people don't know about it.
• D2A should be easier than this one.
• I've found generalized version of this problem in POI.
• Isn't this obvious?
• This problem is not very interesting.
• This is too (censored).
• After lots of rejections, I tried my best to make problems to be interesting. I hope you like at least some of my problems.
• This round was originally supposed to be rated for Div.2 only. However, after we completed Phase 1 testing, we found that my round is too hard for Div.2, so we added more problems and made this round to be Div.1.
• In this round, statements will be even shorter than last contest.
• Even for some of problems which my coordinator approved, there were critical issues that made problems to be excluded. I will introduce some of my rejected problems which won't be used anymore in another post, after this contest ends.

I hope everyone can enjoy my third contest. Thanks in advance!

1. Score Distribution:
• Div.1: 500 1000 1500 2000 2750
• Div.2: 500 750 1250 1750 2250
2. I am sorry for such Div2C/Div1A statement issue. We fixed that immediately after few minutes to the round, but we should have announced it.
3. Editorial is posted: https://codeforces.com/blog/entry/75913
4. I opened new mashup for excluded problems. These problems are originally approved by antontrygubO_o but excluded for some reasons.
1. Binomial Determinant is old Div1D. We found this problem on google so we removed this.
2. Divisible Xor is old Div1A. But since we made 3 xor problems, we removed this one.

Followings are winners:

<Div.1>

<Div.2>

• +1622

By McDic, history, 12 months ago,

Introduction

Hello. I would like to share some nice stuff, called Sherman-Morrison formula. If you know this formula, it's easier to understand how BFGS update works in convex optimization and machine learning. But in this topic, we will just simply focus on this formula and learn how to calculate inverse matrix of rank-$1$ updated invertible matrix faster.

The motivation of this post is that my problem using Sherman Morrison formula is rejected by multiple coordinators.

Definition

You have invertible $\mathbb{R}^{n \times n}$ matrix $A$, and $\mathbb{R}^{n}$ vectors $u$ and $v$. Then $(A + uv^{T})^{-1} = A^{-1} - \frac{A^{-1}uv^{T}A^{-1}}{v^{T}A^{-1}u + 1}$. If $v^{T}A^{-1}u = -1$, then $A + uv^{T}$ is non-invertible.

Time complexity

You can calculate Sherman Morrison formula in $O(n^2)$, because $A^{-1}u$, $v^{T}A^{-1}$ are vector.

Normally you need $O(n^3)$ time complexity to calculate inverse matrix except for some special matrix(diagonal matrix etc). But, since you can calculate Sherman-Morrison formula in $O(n^2)$, if you find some matrix can be represented as rank-$1$ updated matrix of special matrix, you can calculate inverse of that matrix in $O(n^2)$.

Generalization

There is a generalization of this formula called Woodbury Matrix Identity.

Sample problem

This problem is that rejected problem.

You have matrix $A = \begin{bmatrix} 1 & 2 & \cdots & n \\ n+1 & n+2 & \cdots & 2n \\ \cdots & \cdots & \cdots & \cdots \\ n^{2}-n+1 & n^{2}-n+2 & \cdots & n^{2} \end{bmatrix} + diag(c_{1}, c_{2}, \ldots, c_{n})$.

In $i$-th query, you will select any row or column of $A$ and multiply this by $x_{i}$. Compute $A^{-1}$ if $A$ is invertible after each query.

Constraints: $2 \le n \le 200$, $1 \le q \le 200$, $0 \lt c_{i}$, $x_{i} \neq 0$.

• +12

By McDic, history, 13 months ago,

What the hell is going on?

Someone is making intended rating inflation with hundreds of alts.

Please ban those accounts, and make some policy to save rating atmosphere from abusers.

So far, I found at least 200 dummy accounts in today round's registrants list.

• +408

By McDic, history, 17 months ago,

Hello, I hope all of you enjoyed my contest!

[Behind story of A]

[Behind story of B]

[Behind story of C]

• Initial version of C statement consists of tons of mathematical formula. CF team and testers requested me to reduce amount of mathematical formula.
• This problem was added before a week to the round. If there was no such C, the balance would be bad.
• Thanks for dorijanlendvaj , he improved test data for C a lot!
• My code: https://codeforces.com/contest/1228/submission/61578856

[Behind story of D]

[Behind story of E]

[Behind story of F]

• This problem was the hardest to prepare data. We considered more than 10 types of trees to block various kind of WA solutions.
• I intended top-down error-toleration based case handling approach for this contest, but seems other approaches are also ok.
• Also thanks for dorijanlendvaj here, he is real MVP tester.
• My code: https://codeforces.com/contest/1228/submission/61578884

[Behind story of G (removed problem)]

• Nobody(including red testers) solved this problem for a week. This problem is saved as spare problem for another Div.1 contest.
• I love this beautiful problem than any other problems I ever made.

• +338

By McDic, history, 17 months ago,

다시 만나서 반가워요, 코드포스! (Nice to see you again, Codeforces!)

I'm again happy to introduce you to Codeforces Round #589 (Div. 2). Please look at following information for details:

• This contest will take place on Sep/29/2019 16:05 (Moscow time).
• The round will be rated for all Division 2 participants.
• There are 6 problems and you will have 2 hours to solve them. Score distribution will be announced later.

The listed handles below are contributors. Thank you for all who listed!

For this contest, I tried to improve following things:

• Reasonable difficulty: At my last contest, less than 200 official participants managed to solve at least one of DEF. Especially, 1182D's problem difficulty rating is 2500 and 1182F's problem difficulty rating is 2900(no official solvers!). This is not good for Div.2 participants. In other words, my first contest was hell. So this time, I tried to make my second contest to have more reasonable difficulty than my first contest.
• Stronger data: There were 300+ successful hacks and almost 2000 sysfails at 1182B. At this time, I splitted testing phase into early phase and late phase. I'm bit worried, but I believe data will be stronger than my last contest.
• Compact statement: I remember many people complained about 1182C's super complex statement. I made very compact statements for this round. There is no problem with more than 10 lines of statement(except I/O section) in this contest.

I hope everyone can enjoy my second contest. Thanks in advance!

1. If you want to discuss problems in chat after contest ends, come https://discordapp.com/invite/algorithms and you can enjoy discussion.
2. I have deleted my last problem(G) from this contest during testing period. I really wanted to include that beautiful problem in my contest, but nobody solved that problem for a week. That problem will be appeared in another Div.1 contest.
3. Scoring distribution is 500(A)-1000(B)-1250(C)-1750(D)-2250(E)-2750(F).
4. Editorial: https://codeforces.com/blog/entry/70162
5. Congratulation for winners!

WINNERS (updated):

1. PositionZero
2. supy_2
3. hitman623
4. lzqaq
5. cwise
6. LittleBeetle
7. Tsypkokokokoko
8. i_love_gnar
9. 8-_-8 (handle mentioning is not working on his handle)
10. wdk1745

• +1581

By McDic, history, 19 months ago,

Hello.

I am interested in making contest and I have bunch of problem proposals. My problems are classified as below:

• Used for past(already approved) contests like Round 566
• Used for future contest proposals
• Excluded from contest proposals due to pivoting or something else
• Abandoned

I want to make some problems to private, but for now I can make my contest proposals to private only. Please make some functions that users can make problem proposals to private again!

• +18

By McDic, history, 21 month(s) ago,

Sorry for such difficulty balance. Here is the editorial.

Solution Code for A

Behind story of B: Original B was harder. None of 2100+ rated testers solved original B, so it got downgraded. Also there was more than 15 pretests before.

Solution Code for B

Behind story of C: C is created before few days to contest. If there was no current C, the contest would have hell balances.

Solution Code for C

Behind story of D: Honestly I predicted D as hell hard problem. But other high rated people said it's not that hard.

Solution Code for D

Behind story of E: I didn't expected such well-known problem. My solution for E is more complicated.

Solution Code for E

Behind story of F: This problem was located at D originally.

Solution Code for F

• +102

By McDic, history, 21 month(s) ago,

안녕하세요, 코드포스! (Hello, Codeforces!)

I'm super happy to introduce you to Codeforces Round #566 (Div. 2), which will take place on Jun/11/2019 16:05 (Moscow time).

The round will be rated for all Division 2 participants, yet any Division 1 participants are welcome to join us out of competition.

You will be given 6 problems and 2 hours to solve them. Score distribution will be announced later.

The listed handles below are contributors. Thank you for all who listed!

This is my first Codeforces contest ever. I hope everyone who will join this contest enjoy. Thank you!

WINNERS:

1. Let me spread the meme from McDic Minecraft Telegram group — Ggungah.
2. Score distribution is 500-750-1250-2000-2250-2750.
3. Editorial is available.
4. Congratulations for the winners!
5. I am sorry for weak systests for B and F. Sorry again.

• +514

By McDic, 22 months ago,

Recently I made a problem that requires calculating 20~30 digits of precision. (Calculating high precision is not a main idea, it's just required to solve this problem easily. This approach can be avoided and solvable by only big integers, but it needs very unusual mathematical observation.)

One of my friends said this problem should not be opened for Competitive Programming participants. He said this problem is bad because this requires hard work to self-implement high precision data structures or use built-in structures are not in C++ like Python's decimal.Decimal or Java's java.math.BigDecimal.

Why this feature makes this problem bad as competitive programming problem? I can see many problems in Codeforces force users to use either fast languages like C++ or very weird usage of system calls like I/O operations. Also, some data structures like Red-Black tree are not built in some languages like Python 3. Why not for this case?

Can anyone explain? Thanks in advance.

I removed that problem from my current proposal list. If I succeed to deal with constraints to make avoid BigDecimal/BigInteger easily, I will add it. Other problems are not forcing you to use such data structures. Thank you for all feedbacks.

• +30

By McDic, history, 2 years ago,

Hello.

I am wondering why Codeforces uses separated problems for subtask instead of separated test cases. Polygon is already supporting to have multiple testsets to act similar as subtasks, also Checker from testlib.h supports _pc (Partially Correct), which is intended to give partial score. So I think there is no reason to make separated problems such like R542 Div1 A1. It will be better if Codeforces just give participants partial score instead. Anyone have opinion about it?

• +6

By McDic, history, 2 years ago,

Hello.

Just started to participate contests to fill 25 participation in codeforces, now I even created my github repository to store my implementation :)

Just wanted to show public, you can freely see or criticize my code anytime.

<2019-08-23> Now I have following my own implementations:

• Trie and Aho Corasick
• Segment Tree and Lazy Propagation
• Shortest path algorithms such as Dijkstra and Floyd Warshall
• Disjoint Set Union
• Eratosthenes Sieve (both and O(n))
• Convex Hull (both Graham Scan and Monotone)
• KMP and Polynomial String Hashing
• Matrix (but no advanced operations yet)
• LCA
• and some other uncompleted stuffs

My further future implementation goal is:

• Minimum Spanning Tree (I don't know why I don't have this in my repository. This is easier, I will implement this asap)
• Heavy Light Decomposition (What the heck this is too hard to implement myself)
• Fast prime decomposition and primality test (like Pollard Rho's, Miller-Rabin primality test)
• Optimized Matrix stuffs (Gaussian elimination, Determinant, etc)
• Big Integers and Fractions with basic arithmetic and comparison operators
• Strongly Connected Components

• -16

By McDic, 2 years ago,

I don't even know if my message is reached to Codeforces coordinator correctly. If there is a spreadsheet or document(Google spreadsheet might be the good choice.) to show current Codeforces Round Proposal queue status, people can check if their message is arrived correctly and estimate their email's response time. I hope they will make it someday.

Added 1: It seems GlebsHP is offline for almost 2 months and I sent the proposal email to him. Are he still one of the contributors? If not which coordinator should I resend my proposal email?

• +215

By McDic, 2 years ago,

Hello. I am using Polygon to prepare problems.

This is my generator below:

#include <iostream>
#include "testlib.h"

long long int max2(long long int a, long long int b){
return a>b ? a : b;
}

long long int ten(int x){
long long int s=1;
for(int i=0; i<x; i++) s *= 10;
return s;
}

int main(int argc, char* argv[]){
registerGen(argc, argv, 1);

std::cout << rnd.next(1LL, atoll(argv[1])) << " ";
std::cout << rnd.next(1LL, atoll(argv[2])) << " ";
std::cout << rnd.next(1LL, atoll(argv[3])) << " ";
std::cout << rnd.next(max2(1, atoll(argv[4])/10), max2(100, atoll(argv[4]))) << std::endl;
}


Is there any wrong thing? It always verdict FL in invocation and tests. Thank you for reading this.

EDIT 1 This is the log occurs when I try to generate inputs.  ERROR: Unexpected verdict Can't prepare input file 'C:\Contesters\Work\invoker-prod\work\polygon2\34b2efc622c48530be13ce1989b01907\check-bc2d7412ca16433314f5a03914c1d409\run\input.fd0138e687.txt'.FAILED. Input: