Codeforces Round 191 (Div. 2)

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
327 Codeforces Round 191 (Div. 2) FINISHED False 7200 403464623 July 4, 2013, 12:30 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1575 ) E Axis Walking PROGRAMMING bitmasks combinatorics constructive algorithms dp meet-in-the-middle 2500

Iahub wants to meet his girlfriend Iahubina. They both live in Ox axis (the horizontal axis). Iahub lives at point 0 and Iahubina at point d . Iahub has n positive integers a 1 , a 2 , ..., a n . The sum of those numbers is d . Suppose p 1 , p 2 , ..., p n is a permutation of {1, 2, ..., n } . Then, let b 1 = a p 1 , b 2 = a p 2 and so on. The array b is called a "route". There are n ! different routes, one for each permutation p . Iahub's travel schedule is: he walks b 1 steps on Ox axis, then he makes a break in point b 1 . Then, he walks b 2 more steps on Ox axis and makes a break in point b 1 + b 2 . Similarly, at j -th (1 ≤ j ≤ n ) time he walks b j more steps on Ox axis and makes a break in point b 1 + b 2 + ... + b j . Iahub is very superstitious and has k integers which give him bad luck. He calls a route "good" if he never makes a break in a point corresponding to one of those k numbers. For his own curiosity, answer how many good routes he can make, modulo 1000000007 ( 10 9 + 7 ). The first line contains an integer n ( 1 ≤ n ≤ 24 ). The following line contains n integers: a 1 , a 2 , ..., a n ( 1 ≤ a i ≤ 10 9 ). The third line contains integer k ( 0 ≤ k ≤ 2 ). The fourth line contains k positive integers, representing the numbers that give Iahub bad luck. Each of these numbers does not exceed 10 9 . Output a single integer — the answer of Iahub's dilemma modulo 1000000007 ( 10 9 + 7 ). In the first case consider six possible orderings: 2, 3, 5. Iahub will stop at position 2, 5 and 10. Among them, 5 is bad luck for him. 2, 5, 3. Iahub will stop at position 2, 7 and 10. Among them, 7 is bad luck for him. 3, 2, 5. He will stop at the unlucky 5. 3, 5, 2. This is a valid ordering. 5, 2, 3. He got unlucky twice (5 and 7). 5, 3, 2. Iahub would reject, as it sends him to position 5. In the second case, note that it is possible that two different ways have the identical set of stopping. In fact, all six possible ways have the same stops: [2, 4

Tutorials

Codeforces Round #191 — Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
69841563 1942938446 E Jan. 30, 2020, 1:18 p.m. OK FPC TESTS 50 2182 134758400 2500
40989718 ReaLNero1 E July 30, 2018, 11:12 p.m. OK GNU C++ TESTS 50 404 30003200 2500
28271159 vjudge1 E July 4, 2017, 5:34 a.m. OK GNU C++ TESTS 50 1152 136601600 2500
41210957 Siyuan E Aug. 4, 2018, 10:36 a.m. OK GNU C++ TESTS 50 1184 268800000 2500
41208698 Siyuan E Aug. 4, 2018, 9:15 a.m. OK GNU C++ TESTS 50 1184 268800000 2500
41210829 Siyuan E Aug. 4, 2018, 10:31 a.m. OK GNU C++ TESTS 50 1216 268800000 2500
22638618 vjudge2 E Dec. 1, 2016, 12:09 p.m. OK GNU C++ TESTS 50 1308 134451200 2500
21559234 vjudge1 E Oct. 18, 2016, 6:53 a.m. OK GNU C++ TESTS 50 1308 271052800 2500
25469819 T123CK E March 14, 2017, 9:57 a.m. OK GNU C++ TESTS 50 1372 271155200 2500
25469763 T123CK E March 14, 2017, 9:54 a.m. OK GNU C++ TESTS 50 1402 271155200 2500
25469676 T123CK E March 14, 2017, 9:48 a.m. OK GNU C++ TESTS 50 1402 271155200 2500
65259005 luogu_bot1 E Nov. 17, 2019, 2:23 p.m. OK GNU C++11 TESTS 50 622 134348800 2500
65259035 luogu_bot3 E Nov. 17, 2019, 2:24 p.m. OK GNU C++11 TESTS 50 716 134348800 2500
51150479 yugao E March 11, 2019, 7:21 a.m. OK GNU C++11 TESTS 50 778 134451200 2500
63223802 walkerJ E Oct. 23, 2019, 8:41 a.m. OK GNU C++11 TESTS 50 778 201728000 2500
49345352 luogu_bot3 E Feb. 2, 2019, 5:08 a.m. OK GNU C++11 TESTS 50 808 134451200 2500
68588980 Imakf E Jan. 11, 2020, 12:07 p.m. OK GNU C++11 TESTS 50 810 134451200 2500
62766198 luogu_bot3 E Oct. 17, 2019, 8:43 a.m. OK GNU C++11 TESTS 50 810 134451200 2500
63217865 walkerJ E Oct. 23, 2019, 6:51 a.m. OK GNU C++11 TESTS 50 810 201728000 2500
68101446 luogu_bot4 E Jan. 3, 2020, 3:28 a.m. OK GNU C++11 TESTS 50 842 134451200 2500
52910662 ItzABC E April 17, 2019, 2:01 p.m. OK GNU C++11 TESTS 50 842 134553600 2500
69905342 manu E Jan. 31, 2020, 2 p.m. OK GNU C++14 TESTS 50 654 69836800 2500
29962525 Light E Sept. 1, 2017, 1:33 a.m. OK GNU C++14 TESTS 50 840 302899200 2500
29962593 Light E Sept. 1, 2017, 1:41 a.m. OK GNU C++14 TESTS 50 934 302899200 2500
29962604 Light E Sept. 1, 2017, 1:43 a.m. OK GNU C++14 TESTS 50 934 319897600 2500
31968601 unknowncloud E Nov. 2, 2017, 5:26 a.m. OK GNU C++14 TESTS 50 1060 134553600 2500
69563475 yan-zp E Jan. 26, 2020, 11:31 a.m. OK GNU C++14 TESTS 50 1122 201932800 2500
50645277 vjudge4 E March 1, 2019, 3:31 p.m. OK GNU C++14 TESTS 50 1152 235315200 2500
29692704 Minnakhmetov E Aug. 22, 2017, 8:01 p.m. OK GNU C++14 TESTS 50 1216 201728000 2500
30906888 danya.smelskiy E Oct. 1, 2017, 11:20 a.m. OK GNU C++14 TESTS 50 1246 33689600 2500
48777066 codemonkey01 E Jan. 23, 2019, 4:51 a.m. OK GNU C++14 TESTS 50 1246 134758400 2500
51941039 ivan100sic E March 28, 2019, 2:29 p.m. OK GNU C++17 TESTS 50 684 55705600 2500
49658759 mohammadrobot E Feb. 9, 2019, 11:20 a.m. OK GNU C++17 TESTS 50 810 73420800 2500
57934125 noob.learning E July 29, 2019, 9:51 a.m. OK GNU C++17 TESTS 50 966 134451200 2500
45204572 vjudge3 E Nov. 2, 2018, noon OK GNU C++17 TESTS 50 966 269209600 2500
64641664 vjudge2 E Nov. 10, 2019, 1:23 p.m. OK GNU C++17 TESTS 50 996 151347200 2500
65568797 llbra9z E Nov. 23, 2019, 7:03 a.m. OK GNU C++17 TESTS 50 998 201728000 2500
45378179 vjudge4 E Nov. 6, 2018, 1:23 p.m. OK GNU C++17 TESTS 50 1028 201932800 2500
68011094 Pankin E Dec. 31, 2019, 3:50 p.m. OK GNU C++17 TESTS 50 1122 134451200 2500
68221843 Hooded_Hood E Jan. 5, 2020, 5:15 a.m. OK GNU C++17 TESTS 50 1184 100352000 2500
60961222 luogu_bot5 E Sept. 21, 2019, 5:26 a.m. OK GNU C++17 TESTS 50 1184 134451200 2500
34832040 hAtchiko E Feb. 2, 2018, 8:53 a.m. OK MS C++ TESTS 50 1090 136499200 2500
45380139 vjudge1 E Nov. 6, 2018, 2:17 p.m. OK MS C++ TESTS 50 1402 269004800 2500
45378554 vjudge4 E Nov. 6, 2018, 1:33 p.m. OK MS C++ TESTS 50 1872 403456000 2500
45379342 vjudge4 E Nov. 6, 2018, 1:53 p.m. OK MS C++ TESTS 50 1902 269004800 2500
45379324 vjudge3 E Nov. 6, 2018, 1:53 p.m. OK MS C++ TESTS 50 1964 269004800 2500
28315535 vjudge3 E July 6, 2017, 3:47 a.m. OK MS C++ TESTS 50 2900 153600000 2500

remove filters

Back to search problems