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'The easy and hard versions of this problem differ only in the constraints on n . In the easy version, the sum of values of n^2 over all test cases does not exceed 10^6 . Furthermore, n does not exceed 1000 in each test case. There are 2n light bulbs arranged in a row. Each light bulb has a color from 1 to n (exactly two light bulbs for each color). Initially, all light bulbs are turned off. You choose a set of light bulbs S that you initially turn on. After that, you can perform the following operations in any order any number of times: You want to choose a set of light bulbs S that you initially turn on in such a way that by performing the described operations, you can ensure that all light bulbs are turned on. Calculate two numbers: The first line of the input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follow the descriptions of the test cases. The first line of each test case contains a single integer n ( 2 <= n <= 1000 ) -- the number of pairs of light bulbs. The second line of each test case contains 2n integers c_1, c_2, ... , c_{2n} ( 1 <= c_i <= n ), where c_i is the color of the i -th light bulb. For each color from 1 to n , exactly two light bulbs have this color. Additional constraint on the input: the sum of values of n^2 over all test cases does not exceed 10^6 . For each test case, output two integers: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
238051626 |
pengin_2000 |
G1 |
Dec. 19, 2023, 5:04 p.m. |
OK |
GNU C11 |
TESTS |
20 |
530 |
16076800 |
|
|
238048820 |
-Misaka-Mikoto- |
G1 |
Dec. 19, 2023, 4:59 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
6144000 |
|
|
238097205 |
Sky_walkerL |
G1 |
Dec. 20, 2023, 5:19 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
8294400 |
|
|
238089396 |
v2110030321 |
G1 |
Dec. 20, 2023, 3:23 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
12288000 |
|
|
238097934 |
luogu_bot4 |
G1 |
Dec. 20, 2023, 5:28 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
31 |
16281600 |
|
|
238048344 |
Martian148 |
G1 |
Dec. 19, 2023, 4:58 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
3276800 |
|
|
238080648 |
GeoCalibur |
G1 |
Dec. 19, 2023, 11:30 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
4812800 |
|
|
238054259 |
Aqassem2004 |
G1 |
Dec. 19, 2023, 5:16 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
8294400 |
|
|
238087384 |
RichardLau |
G1 |
Dec. 20, 2023, 2:43 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
21094400 |
|
|
238094251 |
YYZNB |
G1 |
Dec. 20, 2023, 4:38 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
46 |
23449600 |
|
|
238050994 |
GeoCalibur |
G1 |
Dec. 19, 2023, 5:03 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
61 |
5017600 |
|
|
238074592 |
ammar_shaikh |
G1 |
Dec. 19, 2023, 8:50 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
30 |
1740800 |
|
|
238060712 |
Fast_submit |
G1 |
Dec. 19, 2023, 6 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
204800 |
|
|
238074649 |
Mhamad_aboaljood |
G1 |
Dec. 19, 2023, 8:51 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
204800 |
|
|
238064491 |
buihoatchuyenhv |
G1 |
Dec. 19, 2023, 6:35 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
512000 |
|
|
238075604 |
Khaled_k |
G1 |
Dec. 19, 2023, 9:10 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
7987200 |
|
|
238083190 |
AkaiLemon |
G1 |
Dec. 20, 2023, 1:01 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
8192000 |
|
|
238055620 |
ilovep |
G1 |
Dec. 19, 2023, 5:23 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
13209600 |
|
|
238087250 |
Mahm2od |
G1 |
Dec. 20, 2023, 2:40 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
16281600 |
|
|
238069471 |
sumitprajapati |
G1 |
Dec. 19, 2023, 7:32 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
18227200 |
|
|
238089846 |
XHZS_XY |
G1 |
Dec. 20, 2023, 3:30 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
31 |
22835200 |
|
|
238051023 |
frostaur_ |
G1 |
Dec. 19, 2023, 5:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
15 |
8908800 |
|
|
238052344 |
HHU_fl |
G1 |
Dec. 19, 2023, 5:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
30 |
102400 |
|
|
238086874 |
Mys0ul |
G1 |
Dec. 20, 2023, 2:32 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
0 |
|
|
238057048 |
Owmicron |
G1 |
Dec. 19, 2023, 5:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
102400 |
|
|
238056838 |
Ryougi-Shiki |
G1 |
Dec. 19, 2023, 5:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
307200 |
|
|
238079691 |
enslaved |
G1 |
Dec. 19, 2023, 10:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
614400 |
|
|
238095598 |
jinhan814 |
G1 |
Dec. 20, 2023, 4:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
4300800 |
|
|
238087710 |
fs20091003 |
G1 |
Dec. 20, 2023, 2:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
10956800 |
|
|
238088621 |
Mkbk_program_learn |
G1 |
Dec. 20, 2023, 3:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
31 |
181452800 |
|
|
238056028 |
illume2021 |
G1 |
Dec. 19, 2023, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
46 |
1945600 |
|
|
238090108 |
Akash. |
G1 |
Dec. 20, 2023, 3:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
15 |
0 |
|
|
238067643 |
gabriel88766 |
G1 |
Dec. 19, 2023, 7:09 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
15 |
4812800 |
|
|
238066759 |
gabriel88766 |
G1 |
Dec. 19, 2023, 7 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
15 |
4812800 |
|
|
238078155 |
yumkam |
G1 |
Dec. 19, 2023, 10:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
30 |
102400 |
|
|
238070561 |
_tempest |
G1 |
Dec. 19, 2023, 7:48 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
30 |
307200 |
|
|
238094683 |
ocharin |
G1 |
Dec. 20, 2023, 4:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
30 |
409600 |
|
|
238090214 |
lprdsb |
G1 |
Dec. 20, 2023, 3:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
30 |
5017600 |
|
|
238059926 |
LinkinPony |
G1 |
Dec. 19, 2023, 5:54 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
30 |
24371200 |
|
|
238074297 |
_Kushagra__ |
G1 |
Dec. 19, 2023, 8:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
31 |
0 |
|
|
238094634 |
shyamer3 |
G1 |
Dec. 20, 2023, 4:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
31 |
102400 |
|
|
238057629 |
Mamimi |
G1 |
Dec. 19, 2023, 5:36 p.m. |
OK |
Java 17 |
TESTS |
20 |
248 |
1126400 |
|
|
238050088 |
oneq |
G1 |
Dec. 19, 2023, 5:02 p.m. |
OK |
Java 17 |
TESTS |
20 |
295 |
6860800 |
|
|
238066683 |
Dukkha |
G1 |
Dec. 19, 2023, 6:59 p.m. |
OK |
Java 21 |
TESTS |
20 |
327 |
1024000 |
|
|
238059257 |
2100032209 |
G1 |
Dec. 19, 2023, 5:48 p.m. |
OK |
Java 8 |
TESTS |
20 |
140 |
0 |
|
|
238063913 |
yuki_keshiki |
G1 |
Dec. 19, 2023, 6:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
233 |
9625600 |
|
|
238052204 |
titia |
G1 |
Dec. 19, 2023, 5:07 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
295 |
25190400 |
|
|
238071083 |
cy171 |
G1 |
Dec. 19, 2023, 7:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
327 |
9625600 |
|
|
238070598 |
Kustov_Vadim_533 |
G1 |
Dec. 19, 2023, 7:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
343 |
11980800 |
|
|
238070047 |
cy171 |
G1 |
Dec. 19, 2023, 7:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
405 |
10444800 |
|
|
238097581 |
Charming |
G1 |
Dec. 20, 2023, 5:24 a.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
499 |
11571200 |
|
|
238056238 |
sishenzhimu |
G1 |
Dec. 19, 2023, 5:27 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
561 |
61337600 |
|
|
238054545 |
123gjweq2 |
G1 |
Dec. 19, 2023, 5:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
685 |
17100800 |
|
|
238071401 |
maximxls |
G1 |
Dec. 19, 2023, 7:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
811 |
10444800 |
|
|
238099555 |
kavorka |
G1 |
Dec. 20, 2023, 5:47 a.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
982 |
11468800 |
|
|
238053588 |
tamuraup_wa |
G1 |
Dec. 19, 2023, 5:12 p.m. |
OK |
Rust 2021 |
TESTS |
20 |
2277 |
20684800 |
|
|
remove filters
Back to search problems