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'Monocarp is the most famous thief in Berland. This time, he decided to steal two diamonds. Unfortunately for Monocarp, there are n cameras monitoring the diamonds. Each camera has two parameters, t_i and s_i . The first parameter determines whether the camera is monitoring the first diamond only ( t_i=1 ), the second diamond only ( t_i=2 ), or both diamonds ( t_i=3 ). The second parameter determines the number of seconds the camera will be disabled after it is hacked. Every second, Monocarp can perform one of the following three actions: Note that Monocarp can hack a camera multiple times, even if it is currently disabled. Your task is to determine the minimum time it will take Monocarp to steal both diamonds, beginning with the first diamond, or report that it is impossible. The first line contains a single integer n ( 0 <= n <= 1500 ) -- the number of cameras. Then n lines follow, the i -th of them contains two integers t_i and s_i ( 1 <= t_i <= 3 ; 1 <= s_i <= 2n ) -- the parameters of the i -th camera. Print a single integer -- the minimum time it will take for Monocarp to steal the first diamond first and then the second diamond. If it is impossible, print -1. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
227461157 |
rainboy |
F |
Oct. 9, 2023, 10:15 p.m. |
OK |
GNU C11 |
TESTS |
103 |
46 |
102400 |
|
|
227440747 |
shoaib75 |
F |
Oct. 9, 2023, 6:09 p.m. |
OK |
GNU C++14 |
TESTS |
103 |
608 |
307200 |
|
|
227476955 |
MeltedToast |
F |
Oct. 10, 2023, 3:57 a.m. |
OK |
GNU C++17 |
TESTS |
103 |
639 |
307200 |
|
|
227426137 |
liympanda |
F |
Oct. 9, 2023, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
103 |
639 |
307200 |
|
|
227471557 |
Alfalfa_w |
F |
Oct. 10, 2023, 2:35 a.m. |
OK |
GNU C++17 (64) |
TESTS |
103 |
46 |
0 |
|
|
227485429 |
wsyear |
F |
Oct. 10, 2023, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
103 |
31 |
307200 |
|
|
227467802 |
huangpj |
F |
Oct. 10, 2023, 1:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
103 |
31 |
512000 |
|
|
227467917 |
huangpj |
F |
Oct. 10, 2023, 1:27 a.m. |
OK |
GNU C++20 (64) |
TESTS |
103 |
31 |
614400 |
|
|
227439122 |
Slamaa |
F |
Oct. 9, 2023, 5:57 p.m. |
OK |
GNU C++20 (64) |
TESTS |
103 |
265 |
307200 |
|
|
remove filters
Back to search problems