2026 ICPC Asia Pacific Championship - Online Mirror (Unrated, Online Mirror, ICPC Rules, Teams Preferred)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2206 2026 ICPC Asia Pacific Championship - Online Mirror (Unrated, Online Mirror, ICPC Rules, Teams Preferred) FINISHED False 18000 3471323 March 8, 2026, 1:45 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 866 ) J Worldwide Playlist PROGRAMMING

You are planning a trip around the world. For this trip, you have installed a music app containing (n) songs, numbered from (1) to (n). Initially, the app generates a playlist for these (n) songs in the form of a permutation of (1, 2, \ldots, n), denoted by (a_1, a_2, \ldots, a_n). It plays the (n) songs in the order (a_1, a_2, \ldots, a_n): song (a_1) plays first, song (a_2) plays second, and so on. The playlist is infinite : each time after song (a_n) plays, it starts all over from song (a_1). The next song starts playing automatically when the current song finishes. Before a song finishes, you may instead press a skip button to immediately jump to the next song in the playlist. You have a desired permutation of the (n) songs, denoted by (b_1, b_2, \ldots, b_n). This means that you want to listen to (n) songs in full in the order of (b_1, b_2, \ldots, b_n) by strategically pressing the skip button zero or more times. In other words, you want the first song you listen to in full (not skipped) to be song (b_1), the second to be song (b_2), and so on, until the (n)-th is song (b_n). After listening to these (n) songs in full, you stop listening. You use this playlist for (d) days. Between each pair of consecutive days, you update the permutations using three integers (c), (x), and (y) as follows: If (c = 1), then you swap (a_x) and (a_y). If (c = 2), then you swap (b_x) and (b_y). Note that the effect of each update persists to subsequent days. For each day, assuming you start listening from song (a_1), determine the minimum number of times you need to press the skip button so that the songs you listen to in full are (b_1, b_2, \ldots, b_n) in this order. The first line of input contains two integers (n) and (d) ((2 \le n \le 200\,000); (2 \le d \le 200\,000)). The second line contains (n) integers represent

Tutorials

Tutorial (PDF)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365795792 haidautom123 Anhkhoi24 J March 8, 2026, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 44 281 102400
365797938 vyatoslav_ J March 8, 2026, 3:44 a.m. OK C++17 (GCC 7-32) TESTS 44 281 3276800
365794224 AK589 LucZha J March 8, 2026, 2:40 a.m. OK C++17 (GCC 7-32) TESTS 44 281 4096000
365807716 K.An J March 8, 2026, 6:02 a.m. OK C++17 (GCC 7-32) TESTS 44 296 204800
365795759 Sunyn Ruliea_ J March 8, 2026, 3:05 a.m. OK C++17 (GCC 7-32) TESTS 44 296 3276800
365798322 youjiang66 J March 8, 2026, 3:51 a.m. OK C++17 (GCC 7-32) TESTS 44 296 20070400
365814084 qwertyui66 J March 8, 2026, 7:07 a.m. OK C++17 (GCC 7-32) TESTS 44 312 204800
365793464 zlxor J March 8, 2026, 2:26 a.m. OK C++17 (GCC 7-32) TESTS 44 312 204800
365806411 Michael.G bimarahmadani12345 vandykasuryadi J March 8, 2026, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 44 312 921600
365799285 DYTOBYTE Wuskevo kukuk J March 8, 2026, 4:07 a.m. OK C++17 (GCC 7-32) TESTS 44 312 921600
365794239 LanceTheDragonTrainer J March 8, 2026, 2:40 a.m. OK C++20 (GCC 13-64) TESTS 44 218 102400
365792805 Rubikun J March 8, 2026, 2:14 a.m. OK C++20 (GCC 13-64) TESTS 44 218 921600
365798176 hieudxm J March 8, 2026, 3:48 a.m. OK C++20 (GCC 13-64) TESTS 44 218 3276800
365797689 shulliiiiii SpadeZ mamingyuan102475 J March 8, 2026, 3:39 a.m. OK C++20 (GCC 13-64) TESTS 44 234 102400
365792562 VHPro Kuroni fextivity J March 8, 2026, 2:09 a.m. OK C++20 (GCC 13-64) TESTS 44 234 204800
365799801 vnedu J March 8, 2026, 4:17 a.m. OK C++20 (GCC 13-64) TESTS 44 234 3276800
365795720 EricZzzzz GarrisonQ -nameless- J March 8, 2026, 3:04 a.m. OK C++20 (GCC 13-64) TESTS 44 234 3276800
365803931 khoa20100 J March 8, 2026, 5:19 a.m. OK C++20 (GCC 13-64) TESTS 44 234 4096000
365853511 flashmt J March 8, 2026, 1:42 p.m. OK C++20 (GCC 13-64) TESTS 44 250 102400
365809085 pyqjw1 J March 8, 2026, 6:16 a.m. OK C++20 (GCC 13-64) TESTS 44 250 102400
365792131 lucifer2k8 iloveMT iloverainygirl J March 8, 2026, 2:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 218 3276800
365801302 yuki_calm J March 8, 2026, 4:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 0
365817831 bramar2 J March 8, 2026, 7:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 102400
365806095 klee J March 8, 2026, 5:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 102400
365792641 noimi J March 8, 2026, 2:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 102400
365793997 Momotaros J March 8, 2026, 2:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 204800
365942136 chowgz J March 9, 2026, 5:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 307200
365849164 Ibrohim-Shamsiev J March 8, 2026, 1:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 307200
365809052 khoand25112007 J March 8, 2026, 6:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 307200
365796307 Boboge geospiza 1459007298 J March 8, 2026, 3:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 44 234 307200
365806780 cse.scholarx J March 8, 2026, 5:51 a.m. OK GNU C11 TESTS 44 1078 4096000
365801274 CodingLagg pranavjh krishsaini_777 J March 8, 2026, 4:42 a.m. OK Java 21 TESTS 44 343 1024000
365806528 rithishreddy17_ ysharsha1 vineetiwari J March 8, 2026, 5:49 a.m. OK Java 21 TESTS 44 562 6348800
365797487 anwaraftab J March 8, 2026, 3:35 a.m. OK Java 21 TESTS 44 562 12492800
365801842 kevin_0911 J March 8, 2026, 4:51 a.m. OK Java 21 TESTS 44 1609 56422400
365791896 Msgnh zhibohemain J March 8, 2026, 1:56 a.m. OK PyPy 3-64 TESTS 44 468 30003200
365794041 TomGetsu leduchuy J March 8, 2026, 2:36 a.m. OK PyPy 3-64 TESTS 44 484 30208000
365801182 dyppp J March 8, 2026, 4:41 a.m. OK PyPy 3-64 TESTS 44 500 33894400
365796420 Chayanine J March 8, 2026, 3:17 a.m. OK PyPy 3-64 TESTS 44 500 38912000
365792422 mikelou J March 8, 2026, 2:06 a.m. OK PyPy 3-64 TESTS 44 578 111206400
365801236 Vatsal.Varshney Mrs.C_chef J March 8, 2026, 4:41 a.m. OK PyPy 3-64 TESTS 44 703 37376000
365794104 mtsd potato167 toam J March 8, 2026, 2:37 a.m. OK PyPy 3-64 TESTS 44 796 33177600
365795078 physics0523 someone__ tatyam J March 8, 2026, 2:53 a.m. OK PyPy 3-64 TESTS 44 796 33484800
365794592 twosquares Auchenai01 apgpsoop J March 8, 2026, 2:46 a.m. OK PyPy 3-64 TESTS 44 906 31232000
365802997 Sacred_Conqurer J March 8, 2026, 5:08 a.m. OK PyPy 3-64 TESTS 44 921 353689600
365828740 IcyGirl J March 8, 2026, 9:38 a.m. OK Python 3 TESTS 44 1281 39116800
365793154 hellovir J March 8, 2026, 2:20 a.m. OK Python 3 TESTS 44 1671 55091200
365794095 sansen J March 8, 2026, 2:37 a.m. OK Rust 2021 TESTS 44 187 16793600
365856411 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856351 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856183 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856121 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856096 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856095 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856074 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856051 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856047 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0
365856004 J March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0

remove filters

Back to search problems