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.
Problems
B'Seyyed and MoJaK are friends of Sajjad. Sajjad likes a permutation. Seyyed wants to change the permutation in a way that Sajjad won 't like it. Seyyed thinks more swaps yield more probability to do that, so he makes MoJaK to perform a swap between every pair of positions (i, xe2 x80 x89j), where i xe2 x80 x89< xe2 x80 x89j, exactly once. MoJaK doesn 't like to upset Sajjad. Given the permutation, determine whether it is possible to swap all pairs of positions so that the permutation stays the same. If it is possible find how to do that. The first line contains single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891000) -- the size of the permutation. As the permutation is not important, you can consider ai xe2 x80 x89= xe2 x80 x89i, where the permutation is a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an. If it is not possible to swap all pairs of positions so that the permutation stays the same, print "NO", Otherwise print "YES", then print lines: the i-th of these lines should contain two integers a and b (a xe2 x80 x89< xe2 x80 x89b) -- the positions where the i-th swap is performed. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
26880058 |
FalseMirror |
E |
May 5, 2017, 12:18 p.m. |
OK |
D |
TESTS |
59 |
156 |
0 |
|
3100 |
27715799 |
ujjwalkhandelwal21 |
E |
June 11, 2017, 6:08 a.m. |
OK |
GNU C |
TESTS |
59 |
124 |
0 |
|
3100 |
33483454 |
Dreamchaser101 |
E |
Dec. 21, 2017, 2:50 p.m. |
OK |
GNU C |
TESTS |
59 |
124 |
1843200 |
|
3100 |
27016195 |
1919810 |
E |
May 11, 2017, 3:20 p.m. |
OK |
GNU C++ |
TESTS |
59 |
31 |
0 |
|
3100 |
41006515 |
Scut82 |
E |
July 31, 2018, 10:04 a.m. |
OK |
GNU C++ |
TESTS |
59 |
46 |
0 |
|
3100 |
40980960 |
ReaLNero1 |
E |
July 30, 2018, 5:46 p.m. |
OK |
GNU C++ |
TESTS |
59 |
46 |
0 |
|
3100 |
27188721 |
AkaneSasu |
E |
May 18, 2017, 1:39 a.m. |
OK |
GNU C++ |
TESTS |
59 |
46 |
0 |
|
3100 |
41006651 |
Scut82 |
E |
July 31, 2018, 10:10 a.m. |
OK |
GNU C++ |
TESTS |
59 |
46 |
8192000 |
|
3100 |
41006810 |
Scut82 |
E |
July 31, 2018, 10:16 a.m. |
OK |
GNU C++ |
TESTS |
59 |
46 |
32460800 |
|
3100 |
41006682 |
Scut82 |
E |
July 31, 2018, 10:11 a.m. |
OK |
GNU C++ |
TESTS |
59 |
62 |
32358400 |
|
3100 |
40981529 |
ReaLNero1 |
E |
July 30, 2018, 6:02 p.m. |
OK |
GNU C++ |
TESTS |
59 |
77 |
0 |
|
3100 |
32188929 |
Scut82 |
E |
Nov. 10, 2017, 8:21 a.m. |
OK |
GNU C++ |
TESTS |
59 |
124 |
0 |
|
3100 |
31937238 |
xht13127 |
E |
Nov. 1, 2017, 3:21 a.m. |
OK |
GNU C++ |
TESTS |
59 |
124 |
0 |
|
3100 |
54509404 |
LJC00118 |
E |
May 23, 2019, 6:15 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
46 |
0 |
|
3100 |
58639257 |
dyxg |
E |
Aug. 12, 2019, 2:30 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
62 |
0 |
|
3100 |
44572490 |
yasugongshang |
E |
Oct. 20, 2018, 5:32 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
92 |
6348800 |
|
3100 |
44571965 |
yukuai26 |
E |
Oct. 20, 2018, 5:18 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
108 |
6348800 |
|
3100 |
55389911 |
Nanjo_Qi |
E |
June 10, 2019, 9:12 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
109 |
0 |
|
3100 |
59575686 |
zx2003 |
E |
Aug. 27, 2019, 2:04 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
124 |
0 |
|
3100 |
58839770 |
vjudge3 |
E |
Aug. 15, 2019, 1:10 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
124 |
0 |
|
3100 |
57874531 |
lopare |
E |
July 28, 2019, 4:21 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
124 |
0 |
|
3100 |
55993189 |
KLPP |
E |
June 24, 2019, 8:50 a.m. |
OK |
GNU C++11 |
TESTS |
59 |
124 |
0 |
|
3100 |
46817897 |
Itst |
E |
Dec. 9, 2018, 1:11 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
124 |
0 |
|
3100 |
68888431 |
Cyanic |
E |
Jan. 16, 2020, 12:13 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
93 |
0 |
|
3100 |
33368668 |
ImpcO |
E |
Dec. 18, 2017, 5:06 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
93 |
1945600 |
|
3100 |
32086210 |
King_George |
E |
Nov. 6, 2017, 1:54 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
31099489 |
Mjgonzales |
E |
Oct. 7, 2017, 4:50 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
27631725 |
I_Love_Umirzhanova_Amina |
E |
June 7, 2017, 11:44 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
27188436 |
tun |
E |
May 18, 2017, 12:58 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
26874155 |
VPigeonKing |
E |
May 5, 2017, 6:23 a.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
26868374 |
abeker |
E |
May 4, 2017, 9:57 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
26857545 |
xyz2606 |
E |
May 4, 2017, 4:10 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
0 |
|
3100 |
26867970 |
albert96 |
E |
May 4, 2017, 9:21 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
108 |
204800 |
|
3100 |
66624588 |
HyscereXD |
E |
Dec. 11, 2019, 8:25 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
93 |
0 |
|
3100 |
54934586 |
hjk1030 |
E |
June 1, 2019, 3:46 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
109 |
0 |
|
3100 |
44584738 |
q234rty |
E |
Oct. 20, 2018, 9:17 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
109 |
307200 |
|
3100 |
64788089 |
user202729_ |
E |
Nov. 13, 2019, 9:59 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
124 |
0 |
|
3100 |
56600776 |
Ari |
E |
July 5, 2019, 11:57 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
124 |
0 |
|
3100 |
51969897 |
Shayan.P |
E |
March 29, 2019, 11:54 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
124 |
0 |
|
3100 |
58643657 |
Romeolong |
E |
Aug. 12, 2019, 4:54 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
124 |
19046400 |
|
3100 |
42259019 |
Benq |
E |
Aug. 30, 2018, 1:07 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
139 |
204800 |
|
3100 |
42467690 |
.I. |
E |
Sept. 4, 2018, 4:47 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
155 |
8294400 |
|
3100 |
48701054 |
antontrygubO_o |
E |
Jan. 22, 2019, 2:44 a.m. |
OK |
GNU C++17 |
TESTS |
59 |
1450 |
307200 |
|
3100 |
27000884 |
Asgar |
E |
May 10, 2017, 5:39 p.m. |
OK |
Java 8 |
TESTS |
59 |
202 |
0 |
|
3100 |
26862164 |
tomerun |
E |
May 4, 2017, 4:45 p.m. |
OK |
Java 8 |
TESTS |
59 |
265 |
0 |
|
3100 |
26876295 |
camypaper |
E |
May 5, 2017, 8:34 a.m. |
OK |
MS C# |
TESTS |
59 |
202 |
3072000 |
|
3100 |
26863574 |
og.kostya |
E |
May 4, 2017, 5:56 p.m. |
OK |
MS C# |
TESTS |
59 |
1091 |
23859200 |
|
3100 |
26859794 |
kumino |
E |
May 4, 2017, 4:26 p.m. |
OK |
MS C++ |
TESTS |
59 |
124 |
102400 |
|
3100 |
26905928 |
Lewin |
E |
May 6, 2017, 4:28 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
811 |
7987200 |
|
3100 |
26906361 |
Lewin |
E |
May 6, 2017, 4:51 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
811 |
8089600 |
|
3100 |
26906342 |
Lewin |
E |
May 6, 2017, 4:50 p.m. |
OK |
PyPy 3 |
TESTS |
59 |
826 |
8294400 |
|
3100 |
27116869 |
jiezhou0731 |
E |
May 15, 2017, 7:09 a.m. |
OK |
Python 2 |
TESTS |
59 |
639 |
102400 |
|
3100 |
remove filters
Back to search problems