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'You are given an array of integers a of size n and a permutation p of size n . There are q queries of three types coming to you: Please, process all queries and print answers to queries of type 1 . The first line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the size of the array and permutation. The second line contains n integers a_1, a_2, ldots, a_n ( -10^8 <= a_i <= 10^8 ). The third line contains n distinct integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ). The fourth line contains a single integer q -- the number of queries ( 1 <= q <= 2 cdot 10^5 ). Next q lines contain description of queries. The i -th of them starts with an integer t_i ( 1 <= t_i <= 3 ) -- the query type. For every first type query, print a single integer -- the answer to this query. In the first example: There are 6 queries. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
135518381 |
rainboy |
F |
Nov. 14, 2021, 10:13 p.m. |
OK |
GNU C11 |
TESTS |
42 |
3946 |
10342400 |
|
3500 |
135426350 |
Alan233 |
F |
Nov. 14, 2021, 1:30 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
7347 |
18227200 |
|
3500 |
135426593 |
Alan233 |
F |
Nov. 14, 2021, 1:32 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
7892 |
18534400 |
|
3500 |
135518467 |
rainboy |
F |
Nov. 14, 2021, 10:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
2854 |
17408000 |
|
3500 |
135518539 |
rainboy |
F |
Nov. 14, 2021, 10:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
2979 |
18841600 |
|
3500 |
135518514 |
rainboy |
F |
Nov. 14, 2021, 10:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
3010 |
15257600 |
|
3500 |
135518475 |
rainboy |
F |
Nov. 14, 2021, 10:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
3057 |
13721600 |
|
3500 |
135518499 |
rainboy |
F |
Nov. 14, 2021, 10:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
3088 |
22118400 |
|
3500 |
135518421 |
rainboy |
F |
Nov. 14, 2021, 10:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
3743 |
11059200 |
|
3500 |
135531498 |
xay5421 |
F |
Nov. 15, 2021, 1:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
5148 |
442163200 |
|
3500 |
135406993 |
xay5421 |
F |
Nov. 14, 2021, 10:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
5257 |
21606400 |
|
3500 |
135397680 |
xay5421 |
F |
Nov. 14, 2021, 9:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
40 |
5678 |
20992000 |
|
3500 |
135479458 |
Alan233 |
F |
Nov. 14, 2021, 2:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
5927 |
18124800 |
|
3500 |
135398120 |
ecnerwala |
F |
Nov. 14, 2021, 9:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
2901 |
13619200 |
|
3500 |
135395364 |
ecnerwala |
F |
Nov. 14, 2021, 8:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
40 |
4149 |
21913600 |
|
3500 |
135518398 |
rainboy |
F |
Nov. 14, 2021, 10:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
4320 |
11059200 |
|
3500 |
135521243 |
fizetik |
F |
Nov. 15, 2021, 12:42 a.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
6957 |
8908800 |
|
3500 |
remove filters
Back to search problems