Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Problem: Adversarial Temporal Graph with Stateful Encoding
Comment thread
shubuexe marked this conversation as resolved.
Outdated

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 𝑀
Comment thread
shubuexe marked this conversation as resolved.
Outdated

5. 🚫 Forbidden Pattern Constraint
The concatenated labels along your path must NOT contain P as a substring.

Comment thread
shubuexe marked this conversation as resolved.
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

Comment thread
shubuexe marked this conversation as resolved.
Outdated
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
Comment thread
shubuexe marked this conversation as resolved.
Outdated

Comment thread
shubuexe marked this conversation as resolved.
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"
Comment thread
shubuexe marked this conversation as resolved.
Loading