Codeforces Round 319 (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
576 Codeforces Round 319 (Div. 1) FINISHED False 7800 295536587 Sept. 10, 2015, 4:30 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1824 ) B Invariance of Tree PROGRAMMING constructive algorithms dfs and similar greedy trees 2300

B'A tree of size n is an undirected connected graph consisting of n vertices without cycles. Consider some tree with n vertices. We call a tree invariant relative to permutation p xe2 x80 x89= xe2 x80 x89p1p2... pn, if for any two vertices of the tree u and v the condition holds: "vertices u and v are connected by an edge if and only if vertices pu and pv are connected by an edge". You are given permutation p of size n. Find some tree size n, invariant relative to the given permutation. The first line contains number n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- the size of the permutation (also equal to the size of the sought tree). The second line contains permutation pi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). If the sought tree does not exist, print "NO" (without the quotes). Otherwise, print "YES", and then print n xe2 x80 x89- xe2 x80 x891 lines, each of which contains two integers -- the numbers of vertices connected by an edge of the tree you found. The vertices are numbered from 1, the order of the edges and the order of the vertices within the edges does not matter. If there are multiple solutions, output any of them. In the first sample test a permutation transforms edge (4, 1) into edge (1, 4), edge (4, 2) into edge (1, 3) and edge (1, 3) into edge (4, 2). These edges all appear in the resulting tree. It can be shown that in the second sample test no tree satisfies the given condition.'...

Tutorials

Editorial Codeforces Round #319

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
18664419 Gray_58 B June 23, 2016, 1:25 p.m. OK FPC TESTS 58 233 6041600 2300
12935420 tjandra B Sept. 10, 2015, 5:15 p.m. OK GNU C TESTS 58 77 1331200 2300
18497379 htnhtn B June 15, 2016, 12:44 p.m. OK GNU C++ TESTS 58 31 2969600 2300
12954242 whn6325689 B Sept. 11, 2015, 7:15 a.m. OK GNU C++ TESTS 58 46 819200 2300
12954544 faebdc B Sept. 11, 2015, 7:38 a.m. OK GNU C++ TESTS 58 46 1843200 2300
19664289 stonepage B Aug. 6, 2016, 7:05 a.m. OK GNU C++ TESTS 58 46 2764800 2300
41647864 Scut82 B Aug. 16, 2018, 9:47 a.m. OK GNU C++ TESTS 58 46 3174400 2300
18497409 vjtest B June 15, 2016, 12:46 p.m. OK GNU C++ TESTS 58 46 3174400 2300
18497202 htnhtn B June 15, 2016, 12:36 p.m. OK GNU C++ TESTS 58 46 3174400 2300
41654302 Scut82 B Aug. 16, 2018, 1:36 p.m. OK GNU C++ TESTS 58 46 3276800 2300
18498927 vjtest B June 15, 2016, 1:56 p.m. OK GNU C++ TESTS 58 46 3379200 2300
18498910 jszyxw B June 15, 2016, 1:55 p.m. OK GNU C++ TESTS 58 46 3584000 2300
60364426 rainboy B Sept. 10, 2019, 7:58 p.m. OK GNU C11 TESTS 58 405 512000 2300
17859444 vjudge5 B May 11, 2016, 6:07 p.m. OK GNU C++11 TESTS 58 30 2867200 2300
12979614 FizzyDavid B Sept. 13, 2015, 2:42 a.m. OK GNU C++11 TESTS 58 31 614400 2300
17859422 pegasas B May 11, 2016, 6:06 p.m. OK GNU C++11 TESTS 58 31 2867200 2300
12933838 __math B Sept. 10, 2015, 5:06 p.m. OK GNU C++11 TESTS 58 31 4300800 2300
33211687 orzcyc B Dec. 13, 2017, 11:46 a.m. OK GNU C++11 TESTS 58 46 2355200 2300
36039941 zsnuo B March 7, 2018, 10:25 a.m. OK GNU C++11 TESTS 58 46 2457600 2300
12954356 I_Love_Ginger B Sept. 11, 2015, 7:24 a.m. OK GNU C++11 TESTS 58 46 2662400 2300
40986156 ReaLNero1 B July 30, 2018, 8:23 p.m. OK GNU C++11 TESTS 58 46 4300800 2300
18495782 __debug B June 15, 2016, 11:37 a.m. OK GNU C++11 TESTS 58 46 4403200 2300
33155318 _Sakits B Dec. 12, 2017, 12:54 p.m. OK GNU C++11 TESTS 58 46 11673600 2300
45327902 vjudge5 B Nov. 5, 2018, 1:49 p.m. OK GNU C++14 TESTS 58 62 512000 2300
31289353 nishant_coder B Oct. 14, 2017, 4:44 a.m. OK GNU C++14 TESTS 58 62 819200 2300
30277447 vjudge4 B Sept. 12, 2017, 3:27 a.m. OK GNU C++14 TESTS 58 62 1228800 2300
52510687 aid B April 8, 2019, 10:35 p.m. OK GNU C++14 TESTS 58 62 1433600 2300
66301081 stefdasca B Dec. 5, 2019, 7:14 a.m. OK GNU C++14 TESTS 58 62 1638400 2300
31201500 jtnydv25 B Oct. 10, 2017, 7:23 p.m. OK GNU C++14 TESTS 58 62 2252800 2300
27616411 Tooc0ld B June 6, 2017, 2:46 p.m. OK GNU C++14 TESTS 58 62 2764800 2300
27616423 vjudge2 B June 6, 2017, 2:47 p.m. OK GNU C++14 TESTS 58 62 2764800 2300
27044625 fofao_funk B May 12, 2017, 1:37 a.m. OK GNU C++14 TESTS 58 62 3072000 2300
31965635 victoragnez B Nov. 2, 2017, 1:04 a.m. OK GNU C++14 TESTS 58 62 3686400 2300
52797475 chinmay0906 B April 15, 2019, 10:25 p.m. OK GNU C++17 TESTS 58 77 3788800 2300
58838243 spectaclehong B Aug. 14, 2019, 11:11 p.m. OK GNU C++17 TESTS 58 77 4096000 2300
61419210 ivan100sic B Sept. 28, 2019, 11:15 a.m. OK GNU C++17 TESTS 58 77 4096000 2300
61965948 ST_C B Oct. 6, 2019, 8:49 a.m. OK GNU C++17 TESTS 58 78 512000 2300
52580216 Shayan.P B April 10, 2019, 6:42 p.m. OK GNU C++17 TESTS 58 78 614400 2300
66298545 ruo B Dec. 5, 2019, 5:56 a.m. OK GNU C++17 TESTS 58 78 2662400 2300
64437562 kska B Nov. 7, 2019, 2:20 a.m. OK GNU C++17 TESTS 58 78 4096000 2300
69913191 jo_ulej B Jan. 31, 2020, 3:59 p.m. OK GNU C++17 TESTS 58 78 4198400 2300
38757129 spentplaying B May 30, 2018, 2:49 a.m. OK GNU C++17 TESTS 58 78 4812800 2300
56033036 amnesiac_dusk B June 25, 2019, 10:39 a.m. OK GNU C++17 TESTS 58 78 4812800 2300
18264105 behzad.nouri B June 6, 2016, 2 a.m. OK Haskell TESTS 58 93 57651200 2300
18264010 behzad.nouri B June 6, 2016, 1:38 a.m. OK Haskell TESTS 58 108 57651200 2300
12960525 mkirsche B Sept. 11, 2015, 2:32 p.m. OK Java 7 TESTS 58 139 0 2300
16197081 DukeOfYork B Feb. 19, 2016, 9:48 a.m. OK Java 7 TESTS 58 170 0 2300
12958255 fromWork B Sept. 11, 2015, 12:09 p.m. OK Java 7 TESTS 58 171 12697600 2300
12941019 pashka B Sept. 10, 2015, 5:53 p.m. OK Java 7 TESTS 58 186 9830400 2300
12947693 Slamur B Sept. 10, 2015, 8:27 p.m. OK Java 7 TESTS 58 187 12492800 2300
12975509 HidenoriS B Sept. 12, 2015, 4:35 p.m. OK Java 7 TESTS 58 623 0 2300
12936017 davidarcila93 B Sept. 10, 2015, 5:19 p.m. OK Java 7 TESTS 58 685 0 2300
12940089 uwi B Sept. 10, 2015, 5:46 p.m. OK Java 8 TESTS 58 140 0 2300
12943920 vadimmm B Sept. 10, 2015, 6:16 p.m. OK Java 8 TESTS 58 155 0 2300
12942554 bluepichu B Sept. 10, 2015, 6:06 p.m. OK Java 8 TESTS 58 170 0 2300
13246413 Anatoliy95 B Sept. 27, 2015, 8:36 a.m. OK Java 8 TESTS 58 171 0 2300
12944564 hama-du B Sept. 10, 2015, 6:20 p.m. OK Java 8 TESTS 58 171 0 2300
12936216 dalex B Sept. 10, 2015, 5:20 p.m. OK Java 8 TESTS 58 171 0 2300
12934684 ilyakor B Sept. 10, 2015, 5:11 p.m. OK Java 8 TESTS 58 171 0 2300
12987865 pretorium B Sept. 13, 2015, 4:39 p.m. OK Java 8 TESTS 58 187 0 2300
12949642 av_life B Sept. 10, 2015, 10:36 p.m. OK Java 8 TESTS 58 202 5120000 2300
12978540 antonkov B Sept. 12, 2015, 10:11 p.m. OK Java 8 TESTS 58 202 9420800 2300
68293606 JSparrow B Jan. 6, 2020, 12:04 a.m. OK Mono C# TESTS 58 452 28569600 2300
12945049 og.kostya B Sept. 10, 2015, 6:24 p.m. OK MS C# TESTS 58 92 7987200 2300
12936911 azukun B Sept. 10, 2015, 5:24 p.m. OK MS C# TESTS 58 171 26112000 2300
12972688 absi2011 B Sept. 12, 2015, 12:40 p.m. OK MS C++ TESTS 58 62 409600 2300
12942535 Death_Knight_DK B Sept. 10, 2015, 6:06 p.m. OK MS C++ TESTS 58 62 1228800 2300
12993141 dohyun0324 B Sept. 14, 2015, 8:03 a.m. OK MS C++ TESTS 58 62 1638400 2300
13081878 lacclaude B Sept. 18, 2015, 7:40 a.m. OK MS C++ TESTS 58 62 1740800 2300
12941367 Milanin B Sept. 10, 2015, 5:56 p.m. OK MS C++ TESTS 58 62 3891200 2300
13021658 ALWAYSWANNAFLY B Sept. 16, 2015, 11:36 a.m. OK MS C++ TESTS 58 62 7168000 2300
12948624 sas4eka B Sept. 10, 2015, 9 p.m. OK MS C++ TESTS 58 77 819200 2300
12936674 bayleef B Sept. 10, 2015, 5:23 p.m. OK MS C++ TESTS 58 77 1638400 2300
12963376 makesource B Sept. 11, 2015, 5:12 p.m. OK MS C++ TESTS 58 78 3993600 2300
12946547 JKeeJ1e30 B Sept. 10, 2015, 6:39 p.m. OK MS C++ TESTS 58 78 6348800 2300
13335669 ikatanic B Oct. 1, 2015, 7:57 p.m. OK Ocaml TESTS 58 171 3174400 2300
13249896 rpy3cpp B Sept. 27, 2015, 1:32 p.m. OK PyPy 3 TESTS 58 405 11161600 2300
12939688 nwi B Sept. 10, 2015, 5:43 p.m. OK Python 2 TESTS 58 264 16179200 2300
12932389 pythonpro B Sept. 10, 2015, 4:57 p.m. OK Python 2 TESTS 58 296 5427200 2300
12981330 11fingers B Sept. 13, 2015, 8:07 a.m. OK Python 2 TESTS 58 436 12288000 2300
16197807 DukeOfYork B Feb. 19, 2016, 10:38 a.m. OK Python 2 TESTS 58 467 12288000 2300
42133763 Mk_Python_v1 B Aug. 26, 2018, 9:03 p.m. OK Python 2 TESTS 58 592 12288000 2300

remove filters

Back to search problems