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 |
|---|---|---|---|---|---|---|
| 2068 | European Championship 2025 - Online Mirror (Unrated, ICPC Rules, Teams Preferred) | FINISHED | False | 18000 | 35493923 | March 2, 2025, 10:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 61 ) | G | A Very Long Hike | PROGRAMMING | shortest paths |
You are planning a hike in the Peneda-Gerês National Park in the north of Portugal. The park takes its name from two of its highest peaks: Peneda (1340 m) and Gerês (1545 m). For this problem, the park is modelled as an infinite plane, where each position ((x, y)), with (x, y) being integers, has a specific altitude. The altitudes are defined by an (n \times n) matrix (h), which repeats periodically across the plane. Specifically, for any integers (a, b) and (0 \leq x, y < n), the altitude at ((x + an, y + bn)) is (hxy). When you are at position ((x, y)), you can move to any of the four adjacent positions: ((x, y+1)), ((x+1, y)), ((x, y-1)), or ((x-1, y)). The time required to move between two adjacent positions is (1 + \lvert \text{alt}_1 - \text{alt}_2 \rvert), where (\text{alt}_1) and (\text{alt}_2) are the altitudes of the current and destination positions, respectively. Initially, your position is ((0, 0)). Compute the number of distinct positions you can reach within (10^{20}) seconds. Your answer will be considered correct if its relative error is less than (10^{-6}). The first line contains an integer (n) ((2\le n\le 20))—the size of the matrix describing the altitudes. The following (n) lines contain (n) integers each. The ((j+1))-th number on the ((i+1))-th of these lines is (hij) ((0\le hij \le 1545))—the altitude of the position ((i, j)). Print the number of distinct positions you can reach within (10^{20}) seconds. Your answer will be considered correct if its relative error is less than (10^{-6}). In the first sample , every position of the Peneda-Gerês National Park has an altitude of (3). Therefore, the time required to move between two adjacent positions is always equal to (1) second. In this case, one can show that a position ((x, y)) is reachable within (10^{20}) seconds if and only if $$$|x| |
| 140239 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 308701459 | ay1357 | G | March 2, 2025, 7:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 4796 | 35942400 | ||
| 308724412 | Sparkle_Twilight | G | March 3, 2025, 12:14 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 5687 | 353280000 | ||
| 308716725 | dorijanlendvaj | G | March 2, 2025, 9:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 5687 | 353280000 | ||
| 308674338 | hos.lyric maspy maroonrk | G | March 2, 2025, 3:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 2187 | 102400 | ||
| 308682311 | ComPhyPark | G | March 2, 2025, 4:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 2843 | 70041600 | ||
| 308702730 | nludfuck | G | March 2, 2025, 7:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 3968 | 37785600 | ||
| 308670415 | jiangly | G | March 2, 2025, 2:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 3968 | 37785600 | ||
| 308658068 | LeoPro fastmath turmax | G | March 2, 2025, 1:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 5687 | 91545600 | ||
| 308688060 | 244mhq | G | March 2, 2025, 5:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 40 | 5733 | 46284800 |
Back to search problems