Codeforces Round 395 (Div. 1)

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
763 Codeforces Round 395 (Div. 1) FINISHED False 7200 245780699 Feb. 2, 2017, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 712 ) C Timofey and remoduling PROGRAMMING brute force implementation math number theory 2500

B"Little Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime m. Also, Timofey likes to look for arithmetical progressions everywhere. One of his birthday presents was a sequence of distinct integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an. Timofey wants to know whether he can rearrange the elements of the sequence so that is will be an arithmetical progression modulo m, or not. Arithmetical progression modulo m of length n with first element x and difference d is sequence of integers x, xe2 x80 x89x xe2 x80 x89+ xe2 x80 x89d, xe2 x80 x89x xe2 x80 x89+ xe2 x80 x892d, xe2 x80 x89..., xe2 x80 x89x xe2 x80 x89+ xe2 x80 x89(n xe2 x80 x89- xe2 x80 x891) xc2 xb7d, each taken modulo m. The first line contains two integers m and n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109 xe2 x80 x89+ xe2 x80 x897, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105, m is prime) -- Timofey's favorite prime module and the length of the sequence. The second line contains n distinct integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89< xe2 x80 x89m) -- the elements of the sequence. Print -1 if it is not possible to rearrange the elements of the sequence so that is will be an arithmetical progression modulo m. Otherwise, print two integers -- the first element of the obtained progression x (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x xe2 x80 x89< xe2 x80 x89m) and its difference d (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89d xe2 x80 x89< xe2 x80 x89m). If there are multiple answers, print any of them. "...

Tutorials

Codeforces Round #395 [Editorial]

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
24394266 Tebak_Siapa_Aku C Feb. 2, 2017, 7:15 p.m. OK GNU C TESTS 62 171 4096000 2500
30611476 Magolor C Sept. 22, 2017, 10:24 a.m. OK GNU C++ TESTS 62 31 921600 2500
26810896 schloss C May 3, 2017, 12:43 a.m. OK GNU C++ TESTS 62 31 2662400 2500
24803701 limuyang01 C Feb. 19, 2017, 2:03 p.m. OK GNU C++ TESTS 62 31 2867200 2500
24586655 imverypupil C Feb. 11, 2017, 10:11 a.m. OK GNU C++ TESTS 62 31 2867200 2500
31602295 lyx_cjz C Oct. 22, 2017, 11:40 a.m. OK GNU C++ TESTS 62 31 10956800 2500
40982578 ReaLNero1 C July 30, 2018, 6:29 p.m. OK GNU C++ TESTS 62 46 819200 2500
32039692 cdgyp C Nov. 4, 2017, 12:58 a.m. OK GNU C++ TESTS 62 46 921600 2500
30611488 vjudge4 C Sept. 22, 2017, 10:25 a.m. OK GNU C++ TESTS 62 46 921600 2500
32040790 HEXU123 C Nov. 4, 2017, 2:41 a.m. OK GNU C++ TESTS 62 46 1638400 2500
41572753 Scut82 C Aug. 14, 2018, 12:49 a.m. OK GNU C++ TESTS 62 46 2662400 2500
32040618 ypxrain C Nov. 4, 2017, 2:27 a.m. OK GNU C++11 TESTS 62 31 819200 2500
32322625 hawkomg C Nov. 15, 2017, 1:53 a.m. OK GNU C++11 TESTS 62 46 614400 2500
32040295 qrsikno1 C Nov. 4, 2017, 1:56 a.m. OK GNU C++11 TESTS 62 46 819200 2500
41265471 dhuacm4 C Aug. 6, 2018, 6:49 a.m. OK GNU C++11 TESTS 62 46 1126400 2500
32047772 Wearry C Nov. 4, 2017, 9:25 a.m. OK GNU C++11 TESTS 62 46 2662400 2500
24754425 deep_learning C Feb. 18, 2017, 8:33 a.m. OK GNU C++11 TESTS 62 46 2764800 2500
25170586 johsnows C March 3, 2017, 12:50 p.m. OK GNU C++11 TESTS 62 46 2867200 2500
25170564 johsnows C March 3, 2017, 12:49 p.m. OK GNU C++11 TESTS 62 46 2867200 2500
25170538 johsnows C March 3, 2017, 12:48 p.m. OK GNU C++11 TESTS 62 46 2867200 2500
24641159 enigma_aw C Feb. 14, 2017, 3:33 a.m. OK GNU C++11 TESTS 62 46 2867200 2500
24406882 Egor.Lifar C Feb. 3, 2017, 9:51 a.m. OK GNU C++14 TESTS 62 46 3379200 2500
45651612 3015218054 C Nov. 13, 2018, 2:01 a.m. OK GNU C++14 TESTS 62 61 819200 2500
24454230 lych123 C Feb. 5, 2017, 3:21 p.m. OK GNU C++14 TESTS 62 61 3174400 2500
24392457 RamTararam C Feb. 2, 2017, 6:07 p.m. OK GNU C++14 TESTS 62 61 3481600 2500
25149779 hogloid C March 2, 2017, 1:55 p.m. OK GNU C++14 TESTS 62 62 2560000 2500
28646889 knock_out C July 17, 2017, 6:50 p.m. OK GNU C++14 TESTS 62 62 2764800 2500
24427314 saliii C Feb. 4, 2017, 8 a.m. OK GNU C++14 TESTS 62 62 2764800 2500
24419208 abeker C Feb. 3, 2017, 7:41 p.m. OK GNU C++14 TESTS 62 62 2764800 2500
24446812 PItS C Feb. 5, 2017, 7:46 a.m. OK GNU C++14 TESTS 62 62 2867200 2500
24785299 osmanorhan C Feb. 18, 2017, 5:11 p.m. OK GNU C++14 TESTS 62 62 3379200 2500
51794416 chinmay0906 C March 24, 2019, 2:21 p.m. OK GNU C++17 TESTS 62 62 1638400 2500
51881989 antontrygubO_o C March 27, 2019, 2:23 a.m. OK GNU C++17 TESTS 62 62 2457600 2500
36218842 vjudge2 C March 12, 2018, 9:19 a.m. OK GNU C++17 TESTS 62 62 3584000 2500
36218885 vjudge5 C March 12, 2018, 9:21 a.m. OK GNU C++17 TESTS 62 77 3584000 2500
50529353 Elegia C Feb. 26, 2019, 1:03 p.m. OK GNU C++17 TESTS 62 78 1024000 2500
59578030 HNO2 C Aug. 27, 2019, 2:52 p.m. OK GNU C++17 TESTS 62 93 7680000 2500
65753531 KonaeAkira C Nov. 26, 2019, 2:02 p.m. OK GNU C++17 TESTS 62 109 2252800 2500
69051556 HeRaNO C Jan. 18, 2020, 12:56 p.m. OK GNU C++17 TESTS 62 124 3891200 2500
51395261 Nakagawa.Kanon C March 17, 2019, 3:58 a.m. OK GNU C++17 TESTS 62 124 7987200 2500
51395250 Nishihara C March 17, 2019, 3:58 a.m. OK GNU C++17 TESTS 62 124 7987200 2500
36712248 for.toobye321 C March 29, 2018, 7:43 a.m. OK Java 8 TESTS 62 171 21606400 2500
24376033 uwi C Feb. 2, 2017, 2:14 p.m. OK Java 8 TESTS 62 202 20582400 2500
24394915 mmaxio C Feb. 2, 2017, 7:47 p.m. OK Java 8 TESTS 62 202 20787200 2500
24422451 beroul C Feb. 4, 2017, 12:34 a.m. OK Java 8 TESTS 62 217 20992000 2500
29860412 mualanhlung017 C Aug. 29, 2017, 7:41 a.m. OK Java 8 TESTS 62 218 0 2500
27255187 hama-du C May 20, 2017, 10:57 p.m. OK Java 8 TESTS 62 249 4505600 2500
24397916 Dukkha C Feb. 2, 2017, 11:10 p.m. OK Java 8 TESTS 62 249 21811200 2500
24447879 Wolfje C Feb. 5, 2017, 9:15 a.m. OK Java 8 TESTS 62 390 39731200 2500
24475980 fetetriste C Feb. 6, 2017, 8:27 p.m. OK Java 8 TESTS 62 405 20787200 2500
24580928 gpita C Feb. 11, 2017, 2:39 a.m. OK Java 8 TESTS 62 1044 21094400 2500
24389132 camypaper C Feb. 2, 2017, 4:44 p.m. OK MS C# TESTS 62 265 9932800 2500
24394213 AleksanderBalobanov C Feb. 2, 2017, 7:13 p.m. OK MS C++ TESTS 62 62 6041600 2500
24390195 DEGwer C Feb. 2, 2017, 5:02 p.m. OK MS C++ TESTS 62 312 11673600 2500
46057122 vjudge3 C Nov. 22, 2018, 11:31 a.m. OK PyPy 3 TESTS 62 343 21708800 2500
24630750 wiwitrifai C Feb. 13, 2017, 3:21 p.m. OK Python 3 TESTS 62 233 15564800 2500
42141100 Mk_Python_v1 C Aug. 27, 2018, 5:32 a.m. OK Python 3 TESTS 62 264 10342400 2500
46057171 dn6049949 C Nov. 22, 2018, 11:32 a.m. OK Python 3 TESTS 62 296 9318400 2500
24380573 kobae964 C Feb. 2, 2017, 2:46 p.m. OK Rust TESTS 62 124 3891200 2500

remove filters

Back to search problems