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 |
---|---|---|---|---|---|---|
398 | Codeforces Round 233 (Div. 1) | FINISHED | False | 7200 | 344010597 | March 1, 2014, 3:30 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 93 ) | E | Sorting Permutations | PROGRAMMING | #D. Not Quite Lee |
B"We are given a permutation sequence a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an of numbers from 1 to n. Let's assume that in one second, we can choose some disjoint pairs (u1, xe2 x80 x89v1), xe2 x80 x89(u2, xe2 x80 x89v2), xe2 x80 x89..., xe2 x80 x89(uk, xe2 x80 x89vk) and swap all aui and avi for every i at the same time (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ui xe2 x80 x89< xe2 x80 x89vi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). The pairs are disjoint if every ui and vj are different from each other. We want to sort the sequence completely in increasing order as fast as possible. Given the initial permutation, calculate the number of ways to achieve this. Two ways are different if and only if there is a time t, such that the set of pairs used for swapping at that time are different as sets (so ordering of pairs doesn't matter). If the given permutation is already sorted, it takes no time to sort, so the number of ways to sort it is 1. To make the problem more interesting, we have k holes inside the permutation. So exactly k numbers of a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an are not yet determined. For every possibility of filling the holes, calculate the number of ways, and print the total sum of these values modulo 1000000007 (109 xe2 x80 x89+ xe2 x80 x897). The first line contains two integers n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) and k (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8912). The second line contains the permutation sequence a1, xe2 x80 x89..., xe2 x80 x89an (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). If a number is not yet determined, it is denoted as 0. There are exactly k zeroes. All the numbers ai that aren't equal to zero are distinct. Print the total sum of the number of ways modulo 1000000007 (109 xe2 x80 x89+ xe2 x80 x897)."... |
Codeforces Round #233 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
40988987 | ReaLNero1 | E | July 30, 2018, 10:31 p.m. | OK | GNU C++ | TESTS | 122 | 421 | 25804800 | ||
6095686 | krijgertje | E | March 21, 2014, 1:14 a.m. | OK | GNU C++ | TESTS | 122 | 452 | 25804800 | ||
6603429 | ykkkaya | E | May 12, 2014, 1:03 p.m. | OK | GNU C++ | TESTS | 122 | 467 | 25804800 | ||
9406680 | Recos | E | Jan. 12, 2015, 7:44 a.m. | OK | GNU C++ | TESTS | 122 | 701 | 12390400 | ||
7114467 | yangle71 | E | July 16, 2014, 8:30 a.m. | OK | GNU C++ | TESTS | 122 | 733 | 12390400 | ||
14020021 | 130705009 | E | Nov. 2, 2015, 9:11 a.m. | OK | GNU C++ | TESTS | 122 | 842 | 50790400 | ||
6252008 | Los_Angelos_Laycurse | E | April 3, 2014, 4:50 p.m. | OK | GNU C++ | TESTS | 122 | 951 | 26624000 | ||
11265056 | Philipsweng | E | May 25, 2015, 1:02 p.m. | OK | GNU C++ | TESTS | 122 | 982 | 50585600 | ||
36770942 | langsike | E | March 31, 2018, 10:36 a.m. | OK | GNU C++ | TESTS | 122 | 1091 | 30310400 | ||
10662033 | Logic_zys | E | April 12, 2015, 2:18 a.m. | OK | GNU C++ | TESTS | 122 | 1107 | 24064000 | ||
7933696 | zhj | E | Sept. 24, 2014, 7:42 a.m. | OK | GNU C++0x | TESTS | 122 | 1248 | 17612800 | ||
70528080 | big_tq | E | Feb. 7, 2020, 8:40 p.m. | OK | GNU C++11 | TESTS | 122 | 686 | 9318400 | ||
67275118 | ElangBondol | E | Dec. 20, 2019, 9:54 a.m. | OK | GNU C++11 | TESTS | 122 | 701 | 9318400 | ||
63233987 | luogu_bot3 | E | Oct. 23, 2019, 11:47 a.m. | OK | GNU C++11 | TESTS | 122 | 702 | 9318400 | ||
14017153 | JoeyWheeler | E | Nov. 2, 2015, 3:08 a.m. | OK | GNU C++11 | TESTS | 122 | 873 | 11878400 | ||
17139141 | freebsdx | E | April 3, 2016, 3:39 a.m. | OK | GNU C++11 | TESTS | 122 | 873 | 52838400 | ||
56554691 | BAJim_HZJ | E | July 5, 2019, 11:48 a.m. | OK | GNU C++11 | TESTS | 122 | 920 | 50688000 | ||
56616338 | xllarr | E | July 6, 2019, 9:49 a.m. | OK | GNU C++11 | TESTS | 122 | 920 | 71270400 | ||
56612444 | xiaolin2 | E | July 6, 2019, 7:59 a.m. | OK | GNU C++11 | TESTS | 122 | 998 | 75366400 | ||
18916347 | TMC | E | July 6, 2016, 10:12 a.m. | OK | GNU C++11 | TESTS | 122 | 1325 | 26726400 | ||
56615540 | xllarr | E | July 6, 2019, 9:26 a.m. | OK | GNU C++11 | TESTS | 122 | 1434 | 93593600 | ||
54804149 | alan_cty | E | May 29, 2019, 1:16 p.m. | OK | GNU C++14 | TESTS | 122 | 686 | 41472000 | ||
55686942 | yyckjm | E | June 17, 2019, 3:58 p.m. | OK | GNU C++14 | TESTS | 122 | 810 | 18432000 | ||
55909708 | yyckjm | E | June 22, 2019, 12:33 a.m. | OK | GNU C++14 | TESTS | 122 | 857 | 18432000 | ||
23657128 | Ali.Pi | E | Jan. 8, 2017, 9:39 p.m. | OK | GNU C++14 | TESTS | 122 | 998 | 14028800 | ||
55686833 | yyckjm | E | June 17, 2019, 3:55 p.m. | OK | GNU C++14 | TESTS | 122 | 1091 | 18739200 | ||
54803856 | alan_cty | E | May 29, 2019, 1:08 p.m. | OK | GNU C++14 | TESTS | 122 | 1154 | 29081600 | ||
55686633 | yyckjm | E | June 17, 2019, 3:50 p.m. | OK | GNU C++14 | TESTS | 122 | 1387 | 18739200 | ||
23911431 | Reyna | E | Jan. 17, 2017, 10:40 p.m. | OK | GNU C++14 | TESTS | 122 | 1996 | 40550400 | ||
57317581 | ruo | E | July 19, 2019, 8:46 a.m. | OK | GNU C++17 | TESTS | 122 | 1263 | 28876800 | ||
58337538 | Sali_adelkhah | E | Aug. 5, 2019, 12:02 p.m. | OK | GNU C++17 | TESTS | 122 | 1294 | 15257600 | ||
56545173 | baguabagau | E | July 5, 2019, 7:19 a.m. | OK | GNU C++17 | TESTS | 122 | 1310 | 15257600 |
Back to search problems