Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1844 | Codeforces Round 884 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 48180263 | July 11, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 145 ) | H | Multiple of Three Cycles | PROGRAMMING | combinatorics dp ds math |
B'An array a_1, ... ,a_n of length n is initially all blank. There are n updates where one entry of a is updated to some number, such that a becomes a permutation of 1,2, ... ,n after all the updates. After each update, find the number of ways (modulo 998 ,244 ,353 ) to fill in the remaining blank entries of a so that a becomes a permutation of 1,2, ... ,n and all cycle lengths in a are multiples of 3 . A permutation of 1,2, ... ,n is an array of length n consisting of n distinct integers from 1 to n in arbitrary order. A cycle in a permutation a is a sequence of pairwise distinct integers (i_1, ... ,i_k) such that i_2 = a_{i_1},i_3 = a_{i_2}, ... ,i_k = a_{i_{k-1}},i_1 = a_{i_k} . The length of this cycle is the number k , which is a multiple of 3 if and only if k equiv 0 pmod 3 . The first line contains a single integer n ( 3 <= n <= 3 cdot 10^5 , n equiv 0 pmod 3 ). The i -th of the next n lines contains two integers x_i and y_i , representing that the i -th update changes a_{x_i} to y_i . It is guaranteed that x_1, ... ,x_n and y_1, ... ,y_n are permutations of 1,2, ... ,n , i.e. a becomes a permutation of 1,2, ... ,n after all the updates. Output n lines: the number of ways (modulo 998 ,244 ,353 ) after the first 1,2, ... ,n updates. In the first sample, for example, after the 3 rd update the 3 ways to complete the permutation a = [4, _,2,5, _, _] are as follows: In the second sample, the first update creates a cycle of length 1 , so there are no ways to make all cycle lengths a multiple of 3 . '... |
Codeforces Round #884 (Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
213421651 | rainboy | H | July 11, 2023, 8:46 p.m. | OK | GNU C11 | TESTS | 34 | 1388 | 10854400 | ||
213426789 | Ethan_Hunt_69 | H | July 11, 2023, 10:11 p.m. | OK | GNU C++17 | TESTS | 34 | 342 | 44032000 | ||
213396939 | orz | H | July 11, 2023, 5:17 p.m. | OK | GNU C++17 (64) | TESTS | 34 | 280 | 49971200 | ||
213436111 | xiaoziyao | H | July 12, 2023, 1:08 a.m. | OK | GNU C++17 (64) | TESTS | 34 | 499 | 30003200 | ||
213455235 | fireskydd | H | July 12, 2023, 5:34 a.m. | OK | GNU C++20 (64) | TESTS | 34 | 155 | 17100800 | ||
213401907 | cnnfls_csy | H | July 11, 2023, 5:33 p.m. | OK | GNU C++20 (64) | TESTS | 34 | 514 | 95232000 | ||
213418930 | Arnab_11 | H | July 11, 2023, 8:13 p.m. | OK | GNU C++20 (64) | TESTS | 34 | 514 | 95232000 |
Back to search problems