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
May, Gellyfish's friend, loves playing a game called "Inscryption" which is played on a directed acyclic graph with (n) vertices and (m) edges. All edges (a \rightarrow b) satisfy (a<b). You start in vertex (1) with some coins. You need to move from vertex (1) to the vertex where the boss is located along the directed edges, and then fight with the final boss. Each of the (n) vertices of the graph contains a Trader who will sell you a card with power (w_i) for (c_i) coins. You can buy as many cards as you want from each Trader. However, you can only trade with the trader on the (i)-th vertex if you are currently on the (i)-th vertex. In order to defeat the boss, you want the sum of the power of your cards to be as large as possible. You will have to answer the following (q) queries: Given integers (p) and (r). If the final boss is located at vertex (p), and you have (r) coins in the beginning, what is the maximum sum of the power of your cards when you fight the final boss? Note that you are allowed to trade cards on vertex (p). The first line of input contains two integers (n) and (m) ((1 \leq n \leq 200), (n - 1 \leq m \leq \min(\frac {n(n-1)} 2, 2000))) — the number of vertices and the number of edges. The (i)-th of the following (n) lines of input each contains two integers (c_i) and (w_i) ((1 \leq c_i \leq 200), (1 \leq w_i \leq 10^9)) — describing the cards of the Trader on the (i)-th vertex. In the following (m) lines of input, each line contains two integers (u) and (v) ((1 \leq u < v \leq n)), indicating a directed edge from vertex (u) to vertex (v). It is guaranteed that every edge ((u,v)) appears at most once. The next line of input contains one single integer (q) ((1 \leq q \leq 2 \cdot 10^5)) — the number of queries. In the following (q) lines of input, each line contains two integers (p) |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
322341437 |
Kriz_Wu |
E |
June 1, 2025, 4:46 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
50 |
2030 |
144588800 |
|
|
|
322276073 |
tourist |
E |
May 31, 2025, 4:06 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
50 |
624 |
69427200 |
|
|
|
322300606 |
RDDCCD |
E |
May 31, 2025, 5:49 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
50 |
2062 |
131072000 |
|
|
|
322292375 |
RGB_ICPC1 |
E |
May 31, 2025, 4:32 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
50 |
2390 |
141721600 |
|
|
|
322321837 |
maspy |
E |
May 31, 2025, 9:31 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
452 |
67481600 |
|
|
|
322277481 |
Kevin114514 |
E |
May 31, 2025, 4:09 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
640 |
77312000 |
|
|
|
322287269 |
ecnerwala |
E |
May 31, 2025, 4:24 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
687 |
64512000 |
|
|
|
322316002 |
maroonrk |
E |
May 31, 2025, 7:56 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
765 |
67891200 |
|
|
|
322324046 |
A_G |
E |
May 31, 2025, 10:26 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
811 |
66764800 |
|
|
|
322315554 |
Jsonhwrd |
E |
May 31, 2025, 7:50 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
952 |
128819200 |
|
|
|
322279542 |
jiangly |
E |
May 31, 2025, 4:12 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
1015 |
128819200 |
|
|
|
322314853 |
turmax |
E |
May 31, 2025, 7:41 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
1093 |
77209600 |
|
|
|
322328305 |
hos.lyric |
E |
June 1, 2025, 1 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
1202 |
68608000 |
|
|
|
322327797 |
Mangooste |
E |
June 1, 2025, 12:42 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
50 |
1312 |
126464000 |
|
|
|
322307763 |
arvindf232 |
E |
May 31, 2025, 6:33 p.m. |
OK |
Kotlin 1.9 |
TESTS |
50 |
1436 |
129740800 |
|
|
remove filters
Back to search problems