Short Sort * Contest: Codeforces - Codeforces Round 898 (Div. 4) * URL: https://codeforces.com/contest/1873/problem/A * MemoryL: 256 MB * TimeL: 1000 ms * === */ #pragma GCC optimize("Ofast") #include<bits/stdc++.h> #define IOS ios::sync_with_stdio(false),cin.tie(nullptr)...
This is supposed to be a short intro to suffix automata — what they are, how they are constructed, and what can they do? It seems that people have had trouble finding an explanation in English (the most popular source mentioned ise-maxx.ru). I don't speak Russian, so this will be ...
There is a node, the distance to cycle is larger than 2 + 1 = 3: For example, if there is a path: 7->8->9->10->11->11, then we have: f^6 (7) = 11 (something on the cycle), but f^3 (7) = 10 (something not on the cycle). Beside these 2 cases, the solution alw...
there should be at least one node in both part, i.e. there should exist i such that x[0][i] = 'O'. And then we can check if for all i,j: x[i][j] = (i-th node and j-th node in the same part ? 'E' : 'O'), if not, there is no solution. Otherwise we can buil...
It turns out this round is unrated due to some system failure. Sorry about the inconvenience it caused. I hope Topcoder can improve their infrastructure soon so that can be as good as codeforces. I will post the problem statement, reference solution and a short editorial here. ...