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"There is a country with n citizens. The i -th of them initially has a_{i} money. The government strictly controls the wealth of its citizens. Whenever a citizen makes a purchase or earns some money, they must send a receipt to the social services mentioning the amount of money they currently have. Sometimes the government makes payouts to the poor: all citizens who have strictly less money than x are paid accordingly so that after the payout they have exactly x money. In this case the citizens don't send a receipt. You know the initial wealth of every citizen and the log of all events: receipts and payouts. Restore the amount of money each citizen has after all events. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^{5} ) -- the numer of citizens. The next line contains n integers a_1 , a_2 , ..., a_n ( 0 <= a_{i} <= 10^{9} ) -- the initial balances of citizens. The next line contains a single integer q ( 1 <= q <= 2 cdot 10^{5} ) -- the number of events. Each of the next q lines contains a single event. The events are given in chronological order. Each event is described as either 1 p x ( 1 <= p <= n , 0 <= x <= 10^{9} ), or 2 x ( 0 <= x <= 10^{9} ). In the first case we have a receipt that the balance of the p -th person becomes equal to x . In the second case we have a payoff with parameter x . Print n integers -- the balances of all citizens after all events. In the first example the balances change as follows: 1 2 3 4 rightarrow 3 3 3 4 rightarrow 3 2 3 4 rightarrow 3 2 3 4 In the second example the balances change as follows: 3 50 2 1 10 rightarrow 3 0 2 1 10 rightarrow 8 8 8 8 10 rightarrow 8 8 20 8 10 "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
58005386 |
Gassa |
B |
July 30, 2019, 3:04 p.m. |
OK |
D |
TESTS |
30 |
265 |
11571200 |
|
1600 |
58005429 |
hos.lyric |
B |
July 30, 2019, 3:04 p.m. |
OK |
D |
TESTS |
30 |
296 |
22630400 |
|
1600 |
58102791 |
hatsuyuki15 |
B |
Aug. 1, 2019, 2:14 a.m. |
OK |
D |
TESTS |
33 |
311 |
6963200 |
|
1600 |
58102977 |
hatsuyuki15 |
B |
Aug. 1, 2019, 2:20 a.m. |
OK |
D |
TESTS |
33 |
326 |
6963200 |
|
1600 |
57998021 |
yosupo |
B |
July 30, 2019, 2:47 p.m. |
OK |
D |
TESTS |
30 |
342 |
36249600 |
|
1600 |
65339765 |
Invisible_Shadow |
B |
Nov. 19, 2019, 10:30 a.m. |
OK |
GNU C11 |
TESTS |
34 |
811 |
2355200 |
|
1600 |
59700863 |
You_Know_Who |
B |
Aug. 30, 2019, 10:36 a.m. |
OK |
GNU C11 |
TESTS |
34 |
811 |
2355200 |
|
1600 |
59896719 |
Alfeh |
B |
Sept. 2, 2019, 12:22 p.m. |
OK |
GNU C11 |
TESTS |
34 |
826 |
2457600 |
|
1600 |
58879203 |
vanhungdo37 |
B |
Aug. 15, 2019, 7:43 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
46 |
2252800 |
|
1600 |
58878426 |
vanhungdo37 |
B |
Aug. 15, 2019, 7:15 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
46 |
2457600 |
|
1600 |
65423832 |
aipostan |
B |
Nov. 20, 2019, 10:01 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
46 |
4300800 |
|
1600 |
58664600 |
luogu_bot2 |
B |
Aug. 12, 2019, 12:10 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
2252800 |
|
1600 |
58533402 |
LJC00118 |
B |
Aug. 10, 2019, 10:41 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
2457600 |
|
1600 |
58877418 |
vanhungdo37 |
B |
Aug. 15, 2019, 6:40 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
2457600 |
|
1600 |
58878470 |
vanhungdo37 |
B |
Aug. 15, 2019, 7:16 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
2457600 |
|
1600 |
58878855 |
vanhungdo37 |
B |
Aug. 15, 2019, 7:29 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
2457600 |
|
1600 |
65423953 |
aipostan |
B |
Nov. 20, 2019, 10:03 a.m. |
OK |
GNU C++11 |
TESTS |
34 |
61 |
4300800 |
|
1600 |
58883573 |
luogu_bot4 |
B |
Aug. 15, 2019, 11:55 p.m. |
OK |
GNU C++11 |
TESTS |
34 |
62 |
2355200 |
|
1600 |
58877448 |
vanhungdo37 |
B |
Aug. 15, 2019, 6:41 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
61 |
2457600 |
|
1600 |
58185408 |
tokitsukaze |
B |
Aug. 2, 2019, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
93 |
4096000 |
|
1600 |
58007697 |
Linkus |
B |
July 30, 2019, 3:10 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
93 |
5632000 |
|
1600 |
58878327 |
vanhungdo37 |
B |
Aug. 15, 2019, 7:12 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
155 |
2457600 |
|
1600 |
58895548 |
mengxiang000 |
B |
Aug. 16, 2019, 7:24 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
171 |
108236800 |
|
1600 |
58104266 |
vjudge5 |
B |
Aug. 1, 2019, 3:10 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
186 |
3379200 |
|
1600 |
58117595 |
yiweiyu |
B |
Aug. 1, 2019, 9:25 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
186 |
4812800 |
|
1600 |
58112038 |
efimmanevich |
B |
Aug. 1, 2019, 7:34 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
187 |
3174400 |
|
1600 |
59662561 |
Scut82 |
B |
Aug. 29, 2019, 1:03 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
202 |
2457600 |
|
1600 |
58618720 |
rhrnald |
B |
Aug. 11, 2019, 2:41 p.m. |
OK |
GNU C++14 |
TESTS |
34 |
202 |
12083200 |
|
1600 |
58005771 |
Unsterblicher_Geist |
B |
July 30, 2019, 3:05 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
93 |
6144000 |
|
1600 |
58876631 |
I_love_Hoang_Yen |
B |
Aug. 15, 2019, 6:13 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
108 |
3993600 |
|
1600 |
58159549 |
aya_uchida |
B |
Aug. 2, 2019, 6:56 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
156 |
4300800 |
|
1600 |
58135022 |
add1ctus |
B |
Aug. 1, 2019, 3:45 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
186 |
3174400 |
|
1600 |
58519234 |
1946037404 |
B |
Aug. 10, 2019, 3:09 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
202 |
5222400 |
|
1600 |
58174990 |
GoogleBot |
B |
Aug. 2, 2019, 12:43 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
202 |
11468800 |
|
1600 |
67521892 |
vjudge5 |
B |
Dec. 24, 2019, 12:42 p.m. |
OK |
GNU C++17 |
TESTS |
34 |
217 |
3379200 |
|
1600 |
58068135 |
toanhphat199 |
B |
July 31, 2019, 9:37 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
217 |
3993600 |
|
1600 |
59555220 |
ryo_issy |
B |
Aug. 27, 2019, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
217 |
4198400 |
|
1600 |
61894716 |
vjudge3 |
B |
Oct. 5, 2019, 6:55 a.m. |
OK |
GNU C++17 |
TESTS |
34 |
218 |
2457600 |
|
1600 |
58498176 |
reanimatorzon |
B |
Aug. 9, 2019, 1:05 p.m. |
OK |
Go |
TESTS |
34 |
124 |
5324800 |
|
1600 |
58229276 |
WangJialei |
B |
Aug. 3, 2019, 3:57 p.m. |
OK |
Go |
TESTS |
34 |
1279 |
27750400 |
|
1600 |
58042805 |
uwi |
B |
July 30, 2019, 8:38 p.m. |
OK |
Java 8 |
TESTS |
31 |
202 |
0 |
|
1600 |
60514947 |
i_will_be_less_than_blue |
B |
Sept. 14, 2019, 6:01 a.m. |
OK |
Java 8 |
TESTS |
34 |
202 |
3788800 |
|
1600 |
58007849 |
StayAwayFromBitches |
B |
July 30, 2019, 3:11 p.m. |
OK |
Java 8 |
TESTS |
30 |
249 |
5017600 |
|
1600 |
58003045 |
Egor |
B |
July 30, 2019, 2:58 p.m. |
OK |
Java 8 |
TESTS |
30 |
264 |
3072000 |
|
1600 |
58077289 |
ISSAM_LAKOUAM |
B |
July 31, 2019, 12:47 p.m. |
OK |
Java 8 |
TESTS |
33 |
265 |
3072000 |
|
1600 |
58140453 |
guillermo_sz |
B |
Aug. 1, 2019, 5:54 p.m. |
OK |
Java 8 |
TESTS |
33 |
265 |
3788800 |
|
1600 |
58098341 |
LAKOUAM_IMAD |
B |
July 31, 2019, 9:32 p.m. |
OK |
Java 8 |
TESTS |
33 |
280 |
2969600 |
|
1600 |
58091086 |
jdurie |
B |
July 31, 2019, 5:35 p.m. |
OK |
Java 8 |
TESTS |
33 |
280 |
3379200 |
|
1600 |
62683763 |
maheshwari29 |
B |
Oct. 16, 2019, 1:32 p.m. |
OK |
Java 8 |
TESTS |
34 |
280 |
3686400 |
|
1600 |
60368789 |
darren_yao |
B |
Sept. 10, 2019, 11:24 p.m. |
OK |
Java 8 |
TESTS |
34 |
280 |
3891200 |
|
1600 |
58146746 |
darnley |
B |
Aug. 1, 2019, 10:12 p.m. |
OK |
Kotlin |
TESTS |
33 |
764 |
16691200 |
|
1600 |
58007524 |
darnley |
B |
July 30, 2019, 3:10 p.m. |
OK |
Kotlin |
TESTS |
30 |
1996 |
15667200 |
|
1600 |
58014779 |
claw88 |
B |
July 30, 2019, 3:31 p.m. |
OK |
Mono C# |
TESTS |
30 |
374 |
28057600 |
|
1600 |
57997156 |
riantkb |
B |
July 30, 2019, 2:45 p.m. |
OK |
Mono C# |
TESTS |
30 |
452 |
37478400 |
|
1600 |
67292219 |
Prais777 |
B |
Dec. 20, 2019, 3:55 p.m. |
OK |
Mono C# |
TESTS |
34 |
920 |
28160000 |
|
1600 |
58012431 |
eki |
B |
July 30, 2019, 3:24 p.m. |
OK |
Mono C# |
TESTS |
30 |
951 |
31027200 |
|
1600 |
58327765 |
tihoson |
B |
Aug. 5, 2019, 8:21 a.m. |
OK |
Mono C# |
TESTS |
34 |
982 |
34304000 |
|
1600 |
64686079 |
vjudge3 |
B |
Nov. 11, 2019, 11:47 a.m. |
OK |
MS C++ |
TESTS |
34 |
171 |
2457600 |
|
1600 |
58103292 |
vjudge3 |
B |
Aug. 1, 2019, 2:31 a.m. |
OK |
MS C++ |
TESTS |
33 |
171 |
3993600 |
|
1600 |
58492893 |
vjudge4 |
B |
Aug. 9, 2019, 10:47 a.m. |
OK |
MS C++ |
TESTS |
34 |
171 |
3993600 |
|
1600 |
61919385 |
vjudge3 |
B |
Oct. 5, 2019, 12:57 p.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
3174400 |
|
1600 |
60832998 |
vjudge5 |
B |
Sept. 19, 2019, 7:47 a.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
4812800 |
|
1600 |
64565101 |
vjudge1 |
B |
Nov. 9, 2019, 7:26 a.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
5632000 |
|
1600 |
64552461 |
vjudge5 |
B |
Nov. 9, 2019, 12:55 a.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
6041600 |
|
1600 |
61101518 |
math957963 |
B |
Sept. 23, 2019, 7:02 a.m. |
OK |
MS C++ |
TESTS |
34 |
202 |
8294400 |
|
1600 |
58265289 |
vjudge1 |
B |
Aug. 4, 2019, 2:15 p.m. |
OK |
MS C++ |
TESTS |
34 |
234 |
14438400 |
|
1600 |
59511898 |
vjudge2 |
B |
Aug. 26, 2019, 8:19 a.m. |
OK |
MS C++ |
TESTS |
34 |
249 |
2457600 |
|
1600 |
61041399 |
vjudge1 |
B |
Sept. 22, 2019, 12:48 a.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
265 |
2457600 |
|
1600 |
58009782 |
P___ |
B |
July 30, 2019, 3:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
30 |
280 |
1638400 |
|
1600 |
58037405 |
Milanin |
B |
July 30, 2019, 6:23 p.m. |
OK |
MS C++ 2017 |
TESTS |
30 |
280 |
2457600 |
|
1600 |
58398466 |
yp0413170331 |
B |
Aug. 6, 2019, 4:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
296 |
6041600 |
|
1600 |
68727777 |
AleksanderBalobanov |
B |
Jan. 13, 2020, 6:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
296 |
6041600 |
|
1600 |
58391650 |
maozaozao |
B |
Aug. 6, 2019, 1:56 p.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
374 |
12800000 |
|
1600 |
58015135 |
mandinga |
B |
July 30, 2019, 3:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
30 |
623 |
5632000 |
|
1600 |
58268377 |
TOXait |
B |
Aug. 4, 2019, 3:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
764 |
2457600 |
|
1600 |
58981460 |
minhminh69 |
B |
Aug. 18, 2019, 4:39 a.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
764 |
5632000 |
|
1600 |
58512172 |
Stul19 |
B |
Aug. 9, 2019, 7:43 p.m. |
OK |
MS C++ 2017 |
TESTS |
34 |
779 |
2457600 |
|
1600 |
58125760 |
mayakin |
B |
Aug. 1, 2019, 12:33 p.m. |
OK |
PHP |
TESTS |
33 |
483 |
98304000 |
|
1600 |
58683264 |
yumtam |
B |
Aug. 12, 2019, 8:17 p.m. |
OK |
PyPy 2 |
TESTS |
34 |
405 |
29286400 |
|
1600 |
58042752 |
drd93 |
B |
July 30, 2019, 8:36 p.m. |
OK |
PyPy 2 |
TESTS |
31 |
529 |
34713600 |
|
1600 |
58042693 |
drd93 |
B |
July 30, 2019, 8:34 p.m. |
OK |
PyPy 2 |
TESTS |
31 |
545 |
34406400 |
|
1600 |
58014451 |
drd93 |
B |
July 30, 2019, 3:30 p.m. |
OK |
PyPy 2 |
TESTS |
30 |
592 |
35430400 |
|
1600 |
58356537 |
porgyturtle |
B |
Aug. 5, 2019, 7:55 p.m. |
OK |
PyPy 2 |
TESTS |
34 |
1309 |
25907200 |
|
1600 |
58003986 |
alexwice |
B |
July 30, 2019, 3 p.m. |
OK |
PyPy 2 |
TESTS |
30 |
1356 |
26214400 |
|
1600 |
59189500 |
jolt.tks |
B |
Aug. 20, 2019, 8:09 p.m. |
OK |
PyPy 2 |
TESTS |
34 |
1388 |
36864000 |
|
1600 |
67429939 |
vjudge2 |
B |
Dec. 22, 2019, 2:53 p.m. |
OK |
PyPy 3 |
TESTS |
34 |
904 |
39833600 |
|
1600 |
58158579 |
FireTruffle |
B |
Aug. 2, 2019, 6:37 a.m. |
OK |
PyPy 3 |
TESTS |
34 |
935 |
26624000 |
|
1600 |
58164978 |
xuzhengqi |
B |
Aug. 2, 2019, 8:44 a.m. |
OK |
PyPy 3 |
TESTS |
34 |
967 |
23142400 |
|
1600 |
58042864 |
conqueror_of_tourist |
B |
July 30, 2019, 8:40 p.m. |
OK |
PyPy 3 |
TESTS |
31 |
982 |
29491200 |
|
1600 |
58142573 |
INIZIORUS |
B |
Aug. 1, 2019, 6:54 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
1029 |
42086400 |
|
1600 |
58009783 |
Kiri8128 |
B |
July 30, 2019, 3:16 p.m. |
OK |
PyPy 3 |
TESTS |
30 |
1044 |
16588800 |
|
1600 |
58877081 |
Helli.code |
B |
Aug. 15, 2019, 6:29 p.m. |
OK |
Python 2 |
TESTS |
34 |
904 |
35430400 |
|
1600 |
58020523 |
MathisHammel |
B |
July 30, 2019, 3:51 p.m. |
OK |
Python 2 |
TESTS |
30 |
1216 |
30617600 |
|
1600 |
58043578 |
conqueror_of_tourist |
B |
July 30, 2019, 9:10 p.m. |
OK |
Python 3 |
TESTS |
31 |
873 |
24166400 |
|
1600 |
58005031 |
whatshisbucket |
B |
July 30, 2019, 3:03 p.m. |
OK |
Python 3 |
TESTS |
30 |
967 |
35430400 |
|
1600 |
58504450 |
frederick99 |
B |
Aug. 9, 2019, 3:46 p.m. |
OK |
Python 3 |
TESTS |
34 |
997 |
47308800 |
|
1600 |
58069956 |
sowlosc |
B |
July 31, 2019, 10:16 a.m. |
OK |
Python 3 |
TESTS |
33 |
1013 |
21708800 |
|
1600 |
58101936 |
KanhuKeNanu |
B |
Aug. 1, 2019, 1:38 a.m. |
OK |
Python 3 |
TESTS |
33 |
1075 |
25907200 |
|
1600 |
59408683 |
shy9546 |
B |
Aug. 24, 2019, 2:53 p.m. |
OK |
Python 3 |
TESTS |
34 |
1170 |
27545600 |
|
1600 |
69211064 |
nealzane |
B |
Jan. 20, 2020, 8:06 p.m. |
OK |
Python 3 |
TESTS |
34 |
1185 |
26214400 |
|
1600 |
58111604 |
MajAK |
B |
Aug. 1, 2019, 7:23 a.m. |
OK |
Python 3 |
TESTS |
33 |
1185 |
27545600 |
|
1600 |
69502515 |
MinecraftFuns |
B |
Jan. 25, 2020, 7:09 a.m. |
OK |
Python 3 |
TESTS |
34 |
1216 |
16793600 |
|
1600 |
58110144 |
Arc293 |
B |
Aug. 1, 2019, 6:45 a.m. |
OK |
Python 3 |
TESTS |
33 |
1231 |
22732800 |
|
1600 |
58009475 |
EbTech |
B |
July 30, 2019, 3:15 p.m. |
OK |
Rust |
TESTS |
30 |
93 |
6348800 |
|
1600 |
61600025 |
ikazuya0201 |
B |
Oct. 1, 2019, 10:32 a.m. |
OK |
Rust |
TESTS |
34 |
202 |
12083200 |
|
1600 |
58050257 |
YeXiaoRain |
B |
July 31, 2019, 2:18 a.m. |
OK |
Rust |
TESTS |
31 |
218 |
10956800 |
|
1600 |
58877492 |
izhuer |
B |
Aug. 15, 2019, 6:43 p.m. |
OK |
Rust |
TESTS |
34 |
233 |
5939200 |
|
1600 |
58086984 |
kobae964 |
B |
July 31, 2019, 4 p.m. |
OK |
Rust |
TESTS |
33 |
280 |
6758400 |
|
1600 |
remove filters
Back to search problems