Codeforces Beta Round 91 (Div. 1 Only)

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
121 Codeforces Beta Round 91 (Div. 1 Only) FINISHED False 7200 418229951 Oct. 27, 2011, 3 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1294 ) C Lucky Permutation PROGRAMMING brute force combinatorics number theory 2000

B'Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One day Petya dreamt of a lexicographically k-th permutation of integers from 1 to n. Determine how many lucky numbers in the permutation are located on the positions whose indexes are also lucky numbers. The first line contains two integers n and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the number of elements in the permutation and the lexicographical number of the permutation. If the k-th permutation of numbers from 1 to n does not exist, print the single number "-1" (without the quotes). Otherwise, print the answer to the problem: the number of such indexes i, that i and ai are both lucky numbers. A permutation is an ordered set of n elements, where each integer from 1 to n occurs exactly once. The element of permutation in position with index i is denoted as ai (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). Permutation a is lexicographically smaller that permutation b if there is such a i (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n), that ai xe2 x80 x89< xe2 x80 x89bi, and for any j (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89j xe2 x80 x89< xe2 x80 x89i) aj xe2 x80 x89= xe2 x80 x89bj. Let 's make a list of all possible permutations of n elements and sort it in the order of lexicographical increasing. Then the lexicographically k-th permutation is the k-th element of this list of permutations. In the first sample the permutation looks like that: 1 2 3 4 6 7 5 The only suitable position is 4. In the second sample the permutation looks like that: 2 1 3 4 The only suitable position is 4.'...

Tutorials

Разбор задач

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
4312736 Misha100896 C Aug. 19, 2013, 2:29 p.m. OK Delphi TESTS 64 30 0 2000
934135 Mazeev C Dec. 7, 2011, 10:08 a.m. OK Delphi TESTS 64 30 819200 2000
807119 Depool C Oct. 27, 2011, 4:49 p.m. OK Delphi TESTS 64 30 819200 2000
800348 tourist C Oct. 27, 2011, 3:13 p.m. OK Delphi TESTS 64 30 819200 2000
808085 Nikolai C Oct. 27, 2011, 5:53 p.m. OK Delphi TESTS 64 30 921600 2000
804077 Shapo C Oct. 27, 2011, 3:59 p.m. OK Delphi TESTS 64 30 921600 2000
802567 CherryTree C Oct. 27, 2011, 3:38 p.m. OK Delphi TESTS 64 30 921600 2000
1994748 AleksanderBalobanov C Aug. 9, 2012, 9:07 a.m. OK Delphi TESTS 64 50 9625600 2000
7897766 daudung1998 C Sept. 21, 2014, 2:11 p.m. OK FPC TESTS 64 30 0 2000
5997945 Nik_Storm_2010 C March 11, 2014, 4:47 p.m. OK FPC TESTS 64 30 102400 2000
885437 coolinging C Nov. 22, 2011, 8:29 a.m. OK FPC TESTS 64 30 1024000 2000
812663 slim_lee C Oct. 28, 2011, 4:28 p.m. OK FPC TESTS 64 30 1024000 2000
810150 LifeKeeper C Oct. 28, 2011, 1:54 a.m. OK FPC TESTS 64 30 1024000 2000
810120 tjg C Oct. 28, 2011, 1:37 a.m. OK FPC TESTS 64 30 1024000 2000
808630 winterwolf94 C Oct. 27, 2011, 6:12 p.m. OK FPC TESTS 64 30 1024000 2000
806129 yenthanh.t7 C Oct. 27, 2011, 4:33 p.m. OK FPC TESTS 64 30 1024000 2000
802715 Sereja C Oct. 27, 2011, 3:40 p.m. OK FPC TESTS 64 30 1024000 2000
1744270 hnivhnivt8695 C May 31, 2012, 7:59 a.m. OK FPC TESTS 64 30 1126400 2000
988393 Sender C Dec. 27, 2011, 2:06 p.m. OK GNU C TESTS 64 30 1433600 2000
804907 kawatea C Oct. 27, 2011, 4:13 p.m. OK GNU C TESTS 64 30 1433600 2000
3931678 Ronnie007 C June 21, 2013, 10:40 a.m. OK GNU C++ TESTS 64 15 0 2000
3879922 vjudge4 C June 13, 2013, 2:55 p.m. OK GNU C++ TESTS 64 15 0 2000
3829771 sd0061 C June 7, 2013, 3:14 a.m. OK GNU C++ TESTS 64 15 0 2000
3765622 amrSamir C May 24, 2013, 3:11 p.m. OK GNU C++ TESTS 64 15 0 2000
3692141 mckkentmwk C May 8, 2013, 5:44 a.m. OK GNU C++ TESTS 64 15 0 2000
3613171 aechavarria C April 23, 2013, 7:15 p.m. OK GNU C++ TESTS 64 15 0 2000
3422748 KuRbI C March 30, 2013, 12:01 p.m. OK GNU C++ TESTS 64 15 0 2000
3370165 dach C March 21, 2013, 3:57 p.m. OK GNU C++ TESTS 64 15 0 2000
3360378 valih10 C March 20, 2013, 10:57 a.m. OK GNU C++ TESTS 64 15 0 2000
3261318 warren_x_x_x C March 7, 2013, 7:27 a.m. OK GNU C++ TESTS 64 15 0 2000
3997273 ishikado C June 30, 2013, 6:34 p.m. OK GNU C++0x TESTS 64 15 0 2000
7096509 wx2486 C July 14, 2014, 3:22 a.m. OK GNU C++0x TESTS 64 30 0 2000
5467116 marat.snowbear C Dec. 18, 2013, 4:59 p.m. OK GNU C++0x TESTS 64 30 0 2000
9506587 maxkvant C Jan. 22, 2015, 9:56 p.m. OK GNU C++0x TESTS 64 30 102400 2000
6461112 atetubou C April 24, 2014, 3:09 p.m. OK GNU C++0x TESTS 64 30 204800 2000
4393131 EarlOfDitches C Sept. 1, 2013, 12:54 p.m. OK GNU C++0x TESTS 64 30 204800 2000
991437 Archon.JK C Dec. 30, 2011, 1:14 a.m. OK GNU C++0x TESTS 64 30 1433600 2000
808854 package.zaic C Oct. 27, 2011, 6:26 p.m. OK GNU C++0x TESTS 64 30 1433600 2000
807965 lyoz C Oct. 27, 2011, 5:49 p.m. OK GNU C++0x TESTS 64 30 1433600 2000
805233 siuvit C Oct. 27, 2011, 4:18 p.m. OK GNU C++0x TESTS 64 30 1433600 2000
59108097 rainboy C Aug. 19, 2019, 6:57 p.m. OK GNU C11 TESTS 64 62 0 2000
27290330 DeadPillow C May 22, 2017, 7:32 p.m. OK GNU C++11 TESTS 64 30 0 2000
21799417 RVS C Oct. 26, 2016, 3:52 p.m. OK GNU C++11 TESTS 64 30 0 2000
19530240 sd0061 C July 31, 2016, 4:22 a.m. OK GNU C++11 TESTS 64 30 0 2000
19365616 shubham1694 C July 23, 2016, 1:19 p.m. OK GNU C++11 TESTS 64 30 0 2000
18868481 totsamyzed C July 3, 2016, 2:04 p.m. OK GNU C++11 TESTS 64 30 0 2000
18817540 eddy1021 C June 30, 2016, 6:10 a.m. OK GNU C++11 TESTS 64 30 0 2000
18611296 I_Love_MohseN C June 20, 2016, 9:03 a.m. OK GNU C++11 TESTS 64 30 0 2000
16407069 2020.01.09_Restart C Feb. 28, 2016, 5:32 p.m. OK GNU C++11 TESTS 64 30 0 2000
15449908 joisino C Jan. 20, 2016, 7:50 a.m. OK GNU C++11 TESTS 64 30 0 2000
29695849 emoairx C Aug. 23, 2017, 1:26 a.m. OK GNU C++11 TESTS 64 30 0 2000
40928711 sepehr81 C July 29, 2018, 9:07 p.m. OK GNU C++14 TESTS 64 30 0 2000
32138584 TillEnd C Nov. 8, 2017, 12:03 p.m. OK GNU C++14 TESTS 64 30 0 2000
30267727 Golovanov399 C Sept. 11, 2017, 2:22 p.m. OK GNU C++14 TESTS 64 30 0 2000
22651876 Farhod_Farmon C Dec. 2, 2016, 5:14 a.m. OK GNU C++14 TESTS 64 30 0 2000
20765719 Motarack C Sept. 19, 2016, 10:49 p.m. OK GNU C++14 TESTS 64 30 0 2000
40571886 Cmise C July 20, 2018, 8:37 a.m. OK GNU C++14 TESTS 64 30 0 2000
32327100 Flash-boy C Nov. 15, 2017, 8:27 a.m. OK GNU C++14 TESTS 64 30 102400 2000
27764087 2360 C June 13, 2017, 10:06 p.m. OK GNU C++14 TESTS 64 30 1024000 2000
27764059 2360 C June 13, 2017, 10:03 p.m. OK GNU C++14 TESTS 64 30 1024000 2000
34612122 yashar_sb_sb C Jan. 27, 2018, 4:50 p.m. OK GNU C++14 TESTS 64 30 1945600 2000
68454865 Phortox C Jan. 9, 2020, 3:47 p.m. OK GNU C++17 TESTS 64 60 0 2000
63227819 KhanhHoa_NNTan C Oct. 23, 2019, 9:53 a.m. OK GNU C++17 TESTS 64 60 2662400 2000
46173727 ivan100sic C Nov. 24, 2018, 2:05 p.m. OK GNU C++17 TESTS 64 62 0 2000
45420752 SYury C Nov. 7, 2018, 5:05 p.m. OK GNU C++17 TESTS 64 62 0 2000
44491962 Nazikk C Oct. 18, 2018, 2:52 p.m. OK GNU C++17 TESTS 64 62 0 2000
44076489 RUSH_D_CAT C Oct. 10, 2018, 1:13 p.m. OK GNU C++17 TESTS 64 62 0 2000
40996524 ak532 C July 31, 2018, 4:19 a.m. OK GNU C++17 TESTS 64 62 0 2000
39822599 Martin53 C July 1, 2018, 1:34 p.m. OK GNU C++17 TESTS 64 62 0 2000
63432670 Sonechko C Oct. 26, 2019, 9:36 a.m. OK GNU C++17 TESTS 64 62 0 2000
55545192 tnakao C June 14, 2019, 1:22 a.m. OK GNU C++17 TESTS 64 62 0 2000
802280 bjin C Oct. 27, 2011, 3:34 p.m. OK Haskell TESTS 64 30 2048000 2000
3612722 DiegoAE C April 23, 2013, 5:33 p.m. OK Java 6 TESTS 64 109 0 2000
3346059 niquefa_diego C March 17, 2013, 8:59 p.m. OK Java 6 TESTS 64 109 102400 2000
812712 pius_88 C Oct. 28, 2011, 4:44 p.m. OK Java 6 TESTS 64 110 35225600 2000
812865 Sinner C Oct. 28, 2011, 5:27 p.m. OK Java 6 TESTS 64 110 35225600 2000
812632 pius_88 C Oct. 27, 2011, 4:47 p.m. OK Java 6 TESTS 64 110 35225600 2000
811742 anhdt C Oct. 28, 2011, 11:10 a.m. OK Java 6 TESTS 64 110 35225600 2000
808286 Hadi_Asiaie C Oct. 27, 2011, 5:58 p.m. OK Java 6 TESTS 64 110 35225600 2000
807215 anhdt C Oct. 27, 2011, 4:51 p.m. OK Java 6 TESTS 64 110 35225600 2000
807964 _jte_ C Oct. 27, 2011, 5:49 p.m. OK Java 6 TESTS 64 110 35430400 2000
807184 unicef C Oct. 27, 2011, 4:50 p.m. OK Java 6 TESTS 64 110 43008000 2000
4529937 hama-du C Sept. 21, 2013, 11:07 a.m. OK Java 7 TESTS 64 156 0 2000
4321915 santjuan C Aug. 22, 2013, 12:11 a.m. OK Java 7 TESTS 64 156 0 2000
12024487 newasmar C July 13, 2015, 2:21 a.m. OK Java 7 TESTS 64 186 0 2000
15949961 mkirsche C Feb. 11, 2016, 3:58 a.m. OK Java 7 TESTS 64 310 0 2000
30951025 Slamur C Oct. 2, 2017, 6:33 p.m. OK Java 8 TESTS 64 218 0 2000
10522232 alibaba C March 30, 2015, 7:04 a.m. OK Java 8 TESTS 64 218 0 2000
54505661 dalt C May 23, 2019, 3:32 a.m. OK Java 8 TESTS 64 248 0 2000
20349689 AlexFetisov C Sept. 2, 2016, 10:58 p.m. OK Java 8 TESTS 64 248 0 2000
32794145 AlanDiakov C Nov. 30, 2017, 2:49 a.m. OK Java 8 TESTS 64 248 20684800 2000
59108098 Dukkha C Aug. 19, 2019, 6:57 p.m. OK Java 8 TESTS 64 278 0 2000
806339 AlphaStream C Oct. 27, 2011, 4:36 p.m. OK Mono C# TESTS 64 90 10035200 2000
834543 ikeyan C Nov. 4, 2011, 1:16 p.m. OK Mono C# TESTS 64 90 10035200 2000
834538 ikeyan C Nov. 4, 2011, 1:15 p.m. OK Mono C# TESTS 64 90 10035200 2000
808231 tanzaku C Oct. 27, 2011, 5:56 p.m. OK Mono C# TESTS 64 90 10035200 2000
836293 flexme C Nov. 5, 2011, 11:54 a.m. OK Mono C# TESTS 64 90 10240000 2000
11273585 Amr_Hassan C May 26, 2015, 5:23 a.m. OK Mono C# TESTS 64 124 204800 2000
4051511 tomas.svab C July 11, 2013, 4:15 p.m. OK MS C++ TESTS 64 15 0 2000
4313735 PAP C Aug. 19, 2013, 8:25 p.m. OK MS C++ TESTS 64 30 819200 2000
18739911 Sandmann C June 26, 2016, 4:09 p.m. OK MS C++ TESTS 64 30 819200 2000
839401 J_M C Nov. 7, 2011, 11:52 a.m. OK MS C++ TESTS 64 30 1433600 2000
1357825 sixteentons C March 14, 2012, 10:05 p.m. OK MS C++ TESTS 64 30 1433600 2000
888133 QZAR C Nov. 23, 2011, 5:23 p.m. OK MS C++ TESTS 64 30 1433600 2000
858800 Warrior C Nov. 11, 2011, 5:35 p.m. OK MS C++ TESTS 64 30 1433600 2000
839930 minh_ltt C Nov. 7, 2011, 4:10 p.m. OK MS C++ TESTS 64 30 1433600 2000
839710 Cromel C Nov. 7, 2011, 2:15 p.m. OK MS C++ TESTS 64 30 1433600 2000
969858 babak C Dec. 20, 2011, 9:52 p.m. OK MS C++ TESTS 64 30 1433600 2000
30260204 Noureldin C Sept. 11, 2017, 6:47 a.m. OK PyPy 2 TESTS 64 154 0 2000
42001505 tanghao C Aug. 23, 2018, 3:28 p.m. OK PyPy 2 TESTS 64 278 0 2000
1353000 neex.emil C March 12, 2012, 6:07 p.m. OK Python 2 TESTS 64 60 2867200 2000
802548 Gassa C Oct. 27, 2011, 3:37 p.m. OK Python 2 TESTS 64 60 2867200 2000
811534 alexej C Oct. 28, 2011, 9:34 a.m. OK Python 2 TESTS 64 60 3174400 2000
2329094 nealzane C Oct. 9, 2012, 3:43 p.m. OK Python 2 TESTS 64 78 0 2000
2329065 nealzane C Oct. 9, 2012, 3:37 p.m. OK Python 2 TESTS 64 78 0 2000
824462 Feu C Nov. 2, 2011, 9:26 a.m. OK Python 2 TESTS 64 80 3481600 2000
887561 mihail C Oct. 27, 2011, 3:06 p.m. OK Python 2 TESTS 64 80 3584000 2000
5184084 TsunamiNoLetGo C Nov. 21, 2013, 10:42 a.m. OK Python 3 TESTS 64 124 0 2000
1204348 K_operafan C Feb. 19, 2012, 3:38 p.m. OK Ruby TESTS 64 110 5632000 2000

remove filters

Back to search problems