From 4a422277dcef82346d29da20c8e586526d5b8545 Mon Sep 17 00:00:00 2001 From: Patel Shubham Date: Sun, 22 Mar 2026 00:31:42 +0530 Subject: [PATCH 1/5] Document adversarial temporal graph problem statement Added problem statement for adversarial temporal graph with constraints and examples. --- .md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .md diff --git a/.md b/.md new file mode 100644 index 00000000..32cd49c8 --- /dev/null +++ b/.md @@ -0,0 +1,77 @@ +Problem: Adversarial Temporal Graph with Stateful Encoding + +Problem Statement +You are given: +A directed graph with n nodes (0 → n-1) +Each edge has: +cost (energy consumption) +time (time taken) +label (a lowercase character 'a'–'z') +An integer K (max energy) +An integer T (max time) +An integer M (modulo) +A forbidden pattern string P + +Rules + +You start at node 0 and want to reach node n-1. + +You maintain: + +1. ⏱ Time +Total time ≤ T + +3. ⚡ Energy +Total energy ≤ K + +4. 🔐 Stateful Encoding +Each path generates a value: +𝑣𝑎𝑙𝑢𝑒=(((0⋅131+𝑐1)⋅131+𝑐2)⋯) mod 𝑀 + +5. 🚫 Forbidden Pattern Constraint +The concatenated labels along your path must NOT contain P as a substring. + +5. 🔁 Temporal Edge Activation +Each edge (u → v) is only usable at certain times: +You are given for each edge: +A list of active intervals [l, r] +You can traverse the edge only if current time ∈ any interval + +7. 🎭 Adversarial Twist +At each node, an adversary can flip one outgoing edge’s label to any character (once per node visit). +You must assume the adversary acts to minimize your final value +You still try to maximize the final value + +Objective +Return the maximum possible encoded value you can guarantee under worst-case adversarial behavior. +If no valid path exists, return -1 + +Constraints +1 ≤ n ≤ 100 +1 ≤ edges ≤ 500 +1 ≤ K ≤ 5000 +1 ≤ T ≤ 5000 +|P| ≤ 50 +Active intervals per edge ≤ 10 + +Example 1: +n = 3 +edges: +0 → 1 (cost=2, time=2, label='a', active=[0,10]) +1 → 2 (cost=2, time=2, label='b', active=[0,10]) + +K = 5 +T = 5 +M = 1000 +P = "ab" + +Example 2: +n = 3 +edges: +0 → 1 (cost=1, time=1, label='a', active=[0,10]) +1 → 2 (cost=1, time=1, label='c', active=[0,10]) + +K = 5 +T = 5 +M = 1000 +P = "ab" From aea84583810bb608adb2e6d1aa9f6f9da3569cb1 Mon Sep 17 00:00:00 2001 From: Patel Shubham Date: Sun, 22 Mar 2026 00:38:06 +0530 Subject: [PATCH 2/5] Update .md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.md b/.md index 32cd49c8..951758c7 100644 --- a/.md +++ b/.md @@ -1,4 +1,5 @@ -Problem: Adversarial Temporal Graph with Stateful Encoding + +# Adversarial Temporal Graph with Stateful Encoding Problem Statement You are given: From ee2275891da521b29f77b1f3625c614cbc4dec84 Mon Sep 17 00:00:00 2001 From: Patel Shubham Date: Sun, 22 Mar 2026 00:38:22 +0530 Subject: [PATCH 3/5] Update .md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.md b/.md index 951758c7..a39b3551 100644 --- a/.md +++ b/.md @@ -26,8 +26,12 @@ Total time ≤ T Total energy ≤ K 4. 🔐 Stateful Encoding -Each path generates a value: -𝑣𝑎𝑙𝑢𝑒=(((0⋅131+𝑐1)⋅131+𝑐2)⋯) mod 𝑀 +Each path generates a value as follows. +Let χ(c) be the integer value of a label character c, defined by χ('a') = 1, χ('b') = 2, …, χ('z') = 26. +For a path whose edge labels form the string c₁c₂…c_L (each cᵢ ∈ {'a', …, 'z'}), define: + value₀ = 0 + valueᵢ = (valueᵢ₋₁ · 131 + χ(cᵢ)) mod M for i = 1…L +The encoded value of the path is value_L. 5. 🚫 Forbidden Pattern Constraint The concatenated labels along your path must NOT contain P as a substring. From 3536fa61a147a0cb0adc30b5615180bd2252f1c5 Mon Sep 17 00:00:00 2001 From: Patel Shubham Date: Sun, 22 Mar 2026 00:38:41 +0530 Subject: [PATCH 4/5] Update .md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.md b/.md index a39b3551..aecae59f 100644 --- a/.md +++ b/.md @@ -40,8 +40,15 @@ The concatenated labels along your path must NOT contain P as a substring. Each edge (u → v) is only usable at certain times: You are given for each edge: A list of active intervals [l, r] -You can traverse the edge only if current time ∈ any interval +Waiting at nodes: +- You may wait at any node for any non-negative amount of time. +- Waiting increases the current time but does not consume energy and does not traverse any edge. + +Edge usage condition: +- Suppose an edge e has traversal time te and active intervals [l, r]. +- You may start traversing e from time τ only if the entire interval [τ, τ + te] is contained in at least one active interval [l, r] for e. +- Equivalently, τ and τ + te must satisfy l ≤ τ and τ + te ≤ r for some [l, r] of that edge. 7. 🎭 Adversarial Twist At each node, an adversary can flip one outgoing edge’s label to any character (once per node visit). You must assume the adversary acts to minimize your final value From aebfa1f042f06dc65a590e3ff76f37304e8277ec Mon Sep 17 00:00:00 2001 From: Patel Shubham Date: Sun, 22 Mar 2026 00:39:22 +0530 Subject: [PATCH 5/5] Update .md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.md b/.md index aecae59f..e23e638b 100644 --- a/.md +++ b/.md @@ -49,10 +49,15 @@ Edge usage condition: - Suppose an edge e has traversal time te and active intervals [l, r]. - You may start traversing e from time τ only if the entire interval [τ, τ + te] is contained in at least one active interval [l, r] for e. - Equivalently, τ and τ + te must satisfy l ≤ τ and τ + te ≤ r for some [l, r] of that edge. -7. 🎭 Adversarial Twist -At each node, an adversary can flip one outgoing edge’s label to any character (once per node visit). -You must assume the adversary acts to minimize your final value -You still try to maximize the final value +7. 🎭 Adversarial Twist (well-defined minimax model) +The game proceeds in discrete moves. A move happens whenever you are at some node u at current time t, with remaining energy and current encoded value. +On each such move, the order of actions is: +1. The adversary may choose at most one outgoing edge e = (u → v) whose label has never been flipped before and permanently change its label to any lowercase character 'a'–'z'. +2. You observe all current labels on outgoing edges of u (including any just flipped by the adversary) and then choose one outgoing edge to traverse, subject to the time, energy, temporal activation, and forbidden-pattern constraints. You may also choose to stop. +3. You traverse the chosen edge, advance time by its time cost, decrease energy by its energy cost, and update the encoded value using the (possibly flipped) label on that edge. +Label flips are persistent: once an edge’s label is changed, all future traversals of that edge see the new label. The adversary cannot change labels of edges that are not outgoing from your current node on that move, and cannot flip the same edge more than once in the entire run. +You must assume the adversary acts to minimize your final value. +You still try to maximize the final value. Objective Return the maximum possible encoded value you can guarantee under worst-case adversarial behavior.