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 two arrays a and b , both of length n . Let's define a function f(l, r) = sum limits_{l <= i <= r} a_i cdot b_i . Your task is to reorder the elements (choose an arbitrary order of elements) of the array b to minimize the value of sum limits_{1 <= l <= r <= n} f(l, r) . Since the answer can be very large, you have to print it modulo 998244353 . Note that you should minimize the answer but not its remainder. The first line of the input contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of elements in a and b . The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ), where a_i is the i -th element of a . The third line of the input contains n integers b_1, b_2, ... , b_n ( 1 <= b_j <= 10^6 ), where b_j is the j -th element of b . Print one integer -- the minimum possible value of sum limits_{1 <= l <= r <= n} f(l, r) after rearranging elements of b , taken modulo 998244353 . Note that you should minimize the answer but not its remainder. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
62870245 |
453908766 |
E |
Oct. 18, 2019, 1:33 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
280 |
14336000 |
|
1800 |
54662895 |
heha1 |
E |
May 26, 2019, 11:42 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
421 |
4505600 |
|
1800 |
54660687 |
heha1 |
E |
May 26, 2019, 10:40 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
436 |
3686400 |
|
1800 |
54662994 |
heha1 |
E |
May 26, 2019, 11:44 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
436 |
4505600 |
|
1800 |
55300937 |
xcodevn |
E |
June 8, 2019, noon |
OK |
D |
TESTS |
11 |
202 |
13107200 |
|
1800 |
54365009 |
Denor |
E |
May 19, 2019, 1:39 a.m. |
OK |
Delphi |
TESTS |
11 |
545 |
3174400 |
|
1800 |
54364970 |
Denor |
E |
May 19, 2019, 1:36 a.m. |
OK |
Delphi |
TESTS |
11 |
545 |
3174400 |
|
1800 |
54364876 |
Denor |
E |
May 19, 2019, 1:29 a.m. |
OK |
Delphi |
TESTS |
11 |
967 |
3174400 |
|
1800 |
54364927 |
Denor |
E |
May 19, 2019, 1:33 a.m. |
OK |
Delphi |
TESTS |
11 |
982 |
3174400 |
|
1800 |
61421672 |
LaSWeeG |
E |
Sept. 28, 2019, 11:56 a.m. |
OK |
FPC |
TESTS |
11 |
218 |
3379200 |
|
1800 |
57576156 |
MRoy |
E |
July 23, 2019, 7:07 a.m. |
OK |
GNU C11 |
TESTS |
11 |
140 |
4812800 |
|
1800 |
54906596 |
ananaygupta70 |
E |
June 1, 2019, 9:06 a.m. |
OK |
GNU C11 |
TESTS |
11 |
156 |
3174400 |
|
1800 |
54318109 |
about |
E |
May 17, 2019, 7:22 p.m. |
OK |
GNU C11 |
TESTS |
11 |
156 |
6451200 |
|
1800 |
55119826 |
White_Devil |
E |
June 5, 2019, 10:32 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
46 |
2969600 |
|
1800 |
55415190 |
DennyQi |
E |
June 11, 2019, 1:21 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
46 |
3072000 |
|
1800 |
54579927 |
HiOkami |
E |
May 25, 2019, 3:51 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
46 |
3174400 |
|
1800 |
59641190 |
JiangZhuoyu |
E |
Aug. 29, 2019, 1:45 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
46 |
24166400 |
|
1800 |
61587864 |
F-Mu |
E |
Oct. 1, 2019, 5:49 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
61 |
3072000 |
|
1800 |
58476477 |
oduesp |
E |
Aug. 9, 2019, 3:22 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
61 |
3174400 |
|
1800 |
54327835 |
Inctry |
E |
May 18, 2019, 4 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
61 |
3276800 |
|
1800 |
58526860 |
chenyewei_1234 |
E |
Aug. 10, 2019, 7:33 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
61 |
6758400 |
|
1800 |
58557585 |
luogu_bot3 |
E |
Aug. 11, 2019, 3:22 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
62 |
3174400 |
|
1800 |
62343756 |
cmwqf |
E |
Oct. 11, 2019, 6:32 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
62 |
3174400 |
|
1800 |
56440555 |
tokitsukaze |
E |
July 2, 2019, 4:07 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
3276800 |
|
1800 |
63425780 |
Mynesis |
E |
Oct. 26, 2019, 7:47 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
109 |
3174400 |
|
1800 |
58330332 |
2017ccut_wuqishuo |
E |
Aug. 5, 2019, 9:09 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
109 |
3174400 |
|
1800 |
54282947 |
vjudge4 |
E |
May 17, 2019, 2:22 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
2457600 |
|
1800 |
59933508 |
vjudge3 |
E |
Sept. 3, 2019, 8:25 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
2457600 |
|
1800 |
66508286 |
Leonardo_Blanger |
E |
Dec. 8, 2019, 3:20 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
2457600 |
|
1800 |
54850461 |
0wner |
E |
May 30, 2019, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
68493317 |
Scut82 |
E |
Jan. 10, 2020, 12:29 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
60401618 |
shrabana99 |
E |
Sept. 11, 2019, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
57332194 |
baohiep |
E |
July 19, 2019, 2:38 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
54876672 |
.tx |
E |
May 31, 2019, 12:08 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
77 |
3276800 |
|
1800 |
54664697 |
chenanqin |
E |
May 26, 2019, 12:39 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
109 |
3174400 |
|
1800 |
54799721 |
__blah |
E |
May 29, 2019, 11:24 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
109 |
3174400 |
|
1800 |
60666834 |
JonasAAA |
E |
Sept. 16, 2019, 8:33 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
2457600 |
|
1800 |
54744519 |
cyh1213 |
E |
May 28, 2019, 9:50 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
54744433 |
cyh1213 |
E |
May 28, 2019, 9:48 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
54739889 |
cyh1213 |
E |
May 28, 2019, 7:17 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
68677003 |
mahesh3008 |
E |
Jan. 12, 2020, 7:08 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
57133924 |
pmitkov |
E |
July 16, 2019, 8:11 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
55328890 |
UncleSema |
E |
June 9, 2019, 9:45 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
124 |
3174400 |
|
1800 |
62608126 |
synapse |
E |
Oct. 15, 2019, 8:38 a.m. |
OK |
Go |
TESTS |
11 |
342 |
4505600 |
|
1800 |
62608040 |
synapse |
E |
Oct. 15, 2019, 8:36 a.m. |
OK |
Go |
TESTS |
11 |
342 |
4505600 |
|
1800 |
64514843 |
DATVN |
E |
Nov. 8, 2019, 10:18 a.m. |
OK |
Java 11 |
TESTS |
11 |
389 |
9523200 |
|
1800 |
63506850 |
MaxHeap |
E |
Oct. 26, 2019, 7:01 p.m. |
OK |
Java 8 |
TESTS |
11 |
171 |
0 |
|
1800 |
54283875 |
revanthreddy85 |
E |
May 17, 2019, 2:51 p.m. |
OK |
Java 8 |
TESTS |
11 |
171 |
0 |
|
1800 |
69877109 |
luchy0120 |
E |
Jan. 31, 2020, 4:39 a.m. |
OK |
Java 8 |
TESTS |
11 |
186 |
0 |
|
1800 |
58539980 |
dyhu083 |
E |
Aug. 10, 2019, 1:42 p.m. |
OK |
Java 8 |
TESTS |
11 |
186 |
0 |
|
1800 |
56983940 |
NMouad21 |
E |
July 13, 2019, 3:06 p.m. |
OK |
Java 8 |
TESTS |
11 |
186 |
0 |
|
1800 |
54543485 |
thisSideAnonymous |
E |
May 24, 2019, 4:24 a.m. |
OK |
Java 8 |
TESTS |
11 |
202 |
2252800 |
|
1800 |
69877086 |
luchy0120 |
E |
Jan. 31, 2020, 4:39 a.m. |
OK |
Java 8 |
TESTS |
11 |
218 |
0 |
|
1800 |
54567844 |
geekymanas |
E |
May 24, 2019, 5:29 p.m. |
OK |
Java 8 |
TESTS |
11 |
233 |
3174400 |
|
1800 |
58132178 |
daniilzimin4 |
E |
Aug. 1, 2019, 2:41 p.m. |
OK |
Java 8 |
TESTS |
11 |
233 |
12492800 |
|
1800 |
55070117 |
Nutella3000 |
E |
June 4, 2019, 5:54 a.m. |
OK |
Java 8 |
TESTS |
11 |
233 |
12800000 |
|
1800 |
57829448 |
stepanovep |
E |
July 27, 2019, 5:29 a.m. |
OK |
Kotlin |
TESTS |
11 |
373 |
16486400 |
|
1800 |
54747107 |
gRaphael |
E |
May 28, 2019, 11:08 a.m. |
OK |
Kotlin |
TESTS |
11 |
561 |
24268800 |
|
1800 |
54587124 |
kiwikiwi |
E |
May 25, 2019, 7:19 a.m. |
OK |
Kotlin |
TESTS |
11 |
607 |
24268800 |
|
1800 |
54642388 |
Dron-elektron |
E |
May 25, 2019, 8:25 p.m. |
OK |
Kotlin |
TESTS |
11 |
608 |
25190400 |
|
1800 |
57934050 |
Spheniscine |
E |
July 29, 2019, 9:49 a.m. |
OK |
Kotlin |
TESTS |
11 |
623 |
25292800 |
|
1800 |
57934202 |
Spheniscine |
E |
July 29, 2019, 9:53 a.m. |
OK |
Kotlin |
TESTS |
11 |
655 |
25395200 |
|
1800 |
54483213 |
treasuryonly |
E |
May 22, 2019, 11:56 a.m. |
OK |
Mono C# |
TESTS |
11 |
202 |
40243200 |
|
1800 |
62672175 |
nadilk |
E |
Oct. 16, 2019, 10:11 a.m. |
OK |
Mono C# |
TESTS |
11 |
218 |
50176000 |
|
1800 |
55188770 |
HadyKo |
E |
June 6, 2019, 5:24 a.m. |
OK |
Mono C# |
TESTS |
11 |
249 |
50688000 |
|
1800 |
54421433 |
vjudge3 |
E |
May 20, 2019, 3:42 p.m. |
OK |
MS C++ |
TESTS |
11 |
108 |
3174400 |
|
1800 |
54738504 |
vjudge1 |
E |
May 28, 2019, 6:28 a.m. |
OK |
MS C++ |
TESTS |
11 |
108 |
3174400 |
|
1800 |
56775035 |
vjudge3 |
E |
July 10, 2019, 2:04 a.m. |
OK |
MS C++ |
TESTS |
11 |
108 |
3174400 |
|
1800 |
54662875 |
vjudge5 |
E |
May 26, 2019, 11:41 a.m. |
OK |
MS C++ |
TESTS |
11 |
108 |
4812800 |
|
1800 |
54489373 |
scorpiowf |
E |
May 22, 2019, 2:44 p.m. |
OK |
MS C++ |
TESTS |
11 |
109 |
3174400 |
|
1800 |
57184845 |
vjudge1 |
E |
July 17, 2019, 8:22 a.m. |
OK |
MS C++ |
TESTS |
11 |
109 |
3174400 |
|
1800 |
54662804 |
vjudge1 |
E |
May 26, 2019, 11:39 a.m. |
OK |
MS C++ |
TESTS |
11 |
109 |
4812800 |
|
1800 |
60439236 |
vjudge3 |
E |
Sept. 12, 2019, 11:51 a.m. |
OK |
MS C++ |
TESTS |
11 |
109 |
16076800 |
|
1800 |
59881592 |
vjudge3 |
E |
Sept. 2, 2019, 5:20 a.m. |
OK |
MS C++ |
TESTS |
11 |
124 |
2457600 |
|
1800 |
54712786 |
YangYaya |
E |
May 27, 2019, 11:28 a.m. |
OK |
MS C++ |
TESTS |
11 |
124 |
3174400 |
|
1800 |
57622391 |
ZSTU-2018329621261 |
E |
July 24, 2019, 5:32 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
140 |
3174400 |
|
1800 |
60438984 |
ChaLemon |
E |
Sept. 12, 2019, 11:46 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
155 |
3174400 |
|
1800 |
60439147 |
ChaLemon |
E |
Sept. 12, 2019, 11:49 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
155 |
16076800 |
|
1800 |
54572608 |
CtrlAlt |
E |
May 24, 2019, 8:21 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
156 |
3174400 |
|
1800 |
54578957 |
mie_mie |
E |
May 25, 2019, 2:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
156 |
4812800 |
|
1800 |
54578964 |
mie_mie |
E |
May 25, 2019, 2:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
156 |
4812800 |
|
1800 |
56159349 |
hrustim25 |
E |
June 27, 2019, 11:42 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
156 |
6553600 |
|
1800 |
54588335 |
myvegatablehasexplode |
E |
May 25, 2019, 7:44 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
186 |
3174400 |
|
1800 |
54407508 |
Y_JARVIS |
E |
May 20, 2019, 7:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
202 |
3993600 |
|
1800 |
63387480 |
Boryan07 |
E |
Oct. 25, 2019, 2:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
342 |
3174400 |
|
1800 |
55679687 |
AryaKnight |
E |
June 17, 2019, 12:23 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
451 |
23244800 |
|
1800 |
54850580 |
SoSooding |
E |
May 30, 2019, 4:22 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
467 |
20787200 |
|
1800 |
54988782 |
scambret |
E |
June 2, 2019, 5:18 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
498 |
20275200 |
|
1800 |
54792663 |
nic6200 |
E |
May 29, 2019, 7:54 a.m. |
OK |
PyPy 2 |
TESTS |
11 |
514 |
19968000 |
|
1800 |
57306943 |
thuutin |
E |
July 19, 2019, 4:30 a.m. |
OK |
PyPy 2 |
TESTS |
11 |
530 |
30515200 |
|
1800 |
54346839 |
raj1307 |
E |
May 18, 2019, 12:52 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
545 |
27340800 |
|
1800 |
55007775 |
thenewguy39 |
E |
June 3, 2019, 8:30 a.m. |
OK |
PyPy 2 |
TESTS |
11 |
577 |
20889600 |
|
1800 |
58635259 |
ssk497 |
E |
Aug. 11, 2019, 11:37 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
577 |
28774400 |
|
1800 |
54389602 |
kabeer27 |
E |
May 19, 2019, 3:23 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
592 |
32972800 |
|
1800 |
55732883 |
bertrandovide |
E |
June 18, 2019, 11:57 p.m. |
OK |
PyPy 2 |
TESTS |
11 |
966 |
25292800 |
|
1800 |
54981780 |
Nikuz |
E |
June 2, 2019, 1:32 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
623 |
22425600 |
|
1800 |
55017517 |
spikerheado1234 |
E |
June 3, 2019, 1:05 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
623 |
22835200 |
|
1800 |
55679670 |
AryaKnight |
E |
June 17, 2019, 12:22 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
623 |
28672000 |
|
1800 |
55640757 |
sdhd |
E |
June 16, 2019, 11:16 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
639 |
22220800 |
|
1800 |
54354163 |
transfusion |
E |
May 18, 2019, 4:37 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
654 |
21708800 |
|
1800 |
55184928 |
ak18shay |
E |
June 6, 2019, 2:43 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
655 |
21811200 |
|
1800 |
54657783 |
yellowflash |
E |
May 26, 2019, 9:13 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
655 |
22425600 |
|
1800 |
54529127 |
OFShare |
E |
May 23, 2019, 4:08 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
670 |
22118400 |
|
1800 |
55307868 |
cavi4762 |
E |
June 8, 2019, 3:39 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
670 |
22528000 |
|
1800 |
54851883 |
shiv1470 |
E |
May 30, 2019, 5:01 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
670 |
22835200 |
|
1800 |
54760146 |
soumyasarkar1998 |
E |
May 28, 2019, 3:39 p.m. |
OK |
Python 2 |
TESTS |
11 |
623 |
15974400 |
|
1800 |
54604080 |
phoenix28 |
E |
May 25, 2019, 9:30 a.m. |
OK |
Python 2 |
TESTS |
11 |
655 |
15872000 |
|
1800 |
55115234 |
Rajan_sust |
E |
June 5, 2019, 8:21 a.m. |
OK |
Python 3 |
TESTS |
11 |
436 |
20172800 |
|
1800 |
54632432 |
diarmuid |
E |
May 25, 2019, 3:07 p.m. |
OK |
Python 3 |
TESTS |
11 |
468 |
20172800 |
|
1800 |
61098756 |
w33z8kqrqk8zzzx33 |
E |
Sept. 23, 2019, 5:26 a.m. |
OK |
Python 3 |
TESTS |
11 |
483 |
18329600 |
|
1800 |
59334793 |
XAMRMAX |
E |
Aug. 23, 2019, 3:54 a.m. |
OK |
Python 3 |
TESTS |
11 |
483 |
18329600 |
|
1800 |
54458937 |
the_white_devil |
E |
May 21, 2019, 5:29 p.m. |
OK |
Python 3 |
TESTS |
11 |
483 |
18841600 |
|
1800 |
54355873 |
Zarzees |
E |
May 18, 2019, 5:34 p.m. |
OK |
Python 3 |
TESTS |
11 |
483 |
20172800 |
|
1800 |
55122434 |
rahulmudambi |
E |
June 5, 2019, 11:20 a.m. |
OK |
Python 3 |
TESTS |
11 |
483 |
24064000 |
|
1800 |
54650060 |
KhuongTran |
E |
May 26, 2019, 4:35 a.m. |
OK |
Python 3 |
TESTS |
11 |
498 |
18329600 |
|
1800 |
54333619 |
vjudge2 |
E |
May 18, 2019, 7:05 a.m. |
OK |
Python 3 |
TESTS |
11 |
498 |
18329600 |
|
1800 |
55001988 |
linkRs |
E |
June 3, 2019, 5:12 a.m. |
OK |
Python 3 |
TESTS |
11 |
498 |
20992000 |
|
1800 |
64046890 |
sansen |
E |
Nov. 1, 2019, 7:47 p.m. |
OK |
Rust |
TESTS |
11 |
77 |
8192000 |
|
1800 |
remove filters
Back to search problems