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
( 78 ) A Compare Suffixes PROGRAMMING interactive

The judge program possesses a hidden string (S) of length (n) consisting only of lowercase Latin letters ( a – z ). You cannot access the string. At the start, only the length (n) is given to you. Your task is to determine the order of all (n) suffixes using a limited number of queries . For an integer (k) ((1 \le k \le n)), let (S(k)) denote the suffix of (S) starting at the (k)-th character. In particular, (S(1)=S). In a single query, you specify two distinct integers (i) and (j). The judge program compares (S(i)) and (S(j)) lexicographically and returns whether (S(i) \lt S(j)) or (S(i) \gt S(j)) to you. Note that ties never occur for (i\not= j) because all suffixes are distinct. Find a permutation ((p_1,p_2,\ldots,p_n)) of ((1,2,\ldots,n)) such that (S(p_1) \lt S(p_2) \lt \cdots \lt S(p_n)). The first line of input contains the integer (n) ((2 \le n \le 1000)). To issue a query, your program should write a line of the form " query (i) (j)" ((1 \le i \le n; 1 \le j \le n; i \not= j)). After that, an input line containing first or second becomes available. A line containing first means (S(i) \lt S(j)), while a line containing second means (S(i) \gt S(j)). Once you determine the order of the suffixes, your program should write a line of the form " answer (p_1) (p_2) (\ldots) (p_n)". After that, the interaction stops and your program should terminate without extra output. Your program may issue at most (6260) queries. If your program issues more than (6260) queries, it will be judged as "Wrong Answer." It is guaranteed that the hidden string (S) consists only of lowercase letters ( a – z ). Notes on interactive judging: The evaluation is non-adversarial, meaning that the string (S) is chosen in advance rather than in response to your queries. Do not forget to flush output buffers after writing. You are provided with a c

Tutorials

Tutorial (PDF)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365820530 dunglt69 A March 8, 2026, 8:15 a.m. OK C++20 (GCC 13-64) TESTS 88 46 102400
365819701 dunglt69 A March 8, 2026, 8:06 a.m. OK C++20 (GCC 13-64) TESTS 88 46 102400
365903403 maynudden4580 A March 8, 2026, 5:52 p.m. OK C++20 (GCC 13-64) TESTS 88 62 102400
365832431 PREMM_DESAI A March 8, 2026, 10:15 a.m. OK C++20 (GCC 13-64) TESTS 88 62 102400
365816243 vignesh13022005 A March 8, 2026, 7:30 a.m. OK C++20 (GCC 13-64) TESTS 88 62 102400
365803671 jiangly EvenImage qiuzx A March 8, 2026, 5:16 a.m. OK C++20 (GCC 13-64) TESTS 88 62 102400
365805443 dXqwq Xun_Xiaoyao crazy_sea A March 8, 2026, 5:36 a.m. OK C++20 (GCC 13-64) TESTS 88 78 102400
365793910 LanceTheDragonTrainer A March 8, 2026, 2:34 a.m. OK C++20 (GCC 13-64) TESTS 88 78 102400
365821674 hpqclab A March 8, 2026, 8:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 62 102400
365817655 navin_777 A March 8, 2026, 7:45 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 62 102400
365817431 navin_777 A March 8, 2026, 7:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 62 102400
365802886 ksun48 ecnerwala A March 8, 2026, 5:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 62 102400
365913616 mohamedtarekfayez005 A March 8, 2026, 7:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 102400
365848880 Ibrohim-Shamsiev A March 8, 2026, 1:01 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 102400
365826479 sanjoy_doit028 A March 8, 2026, 9:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 102400
365812625 Quest1_2_3 A March 8, 2026, 6:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 102400
365809974 0.1w33hw3 maomao90 __baozii__ A March 8, 2026, 6:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 102400
365857732 Fizonel A March 8, 2026, 2:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 88 78 716800
365836295 Msgnh A March 8, 2026, 10:53 a.m. OK PyPy 3-64 TESTS 88 281 5632000
365856407 A March 8, 2026, 1:52 p.m. OK Unknown TESTS 0 0 0

remove filters

Back to search problems