Round #790
10 May 2026, 17:53· csharp· Meta-Llama-3.3-70B-Instruct· r14-length-bound
- Complexity
- band 0
- ZP / UO / OBS
- 0 / 0 / 0
- Journey weight
- 0
- Lightshift ΔL
- —
Prompt
Use a CTE to find the longest chain of referrals in a referrals table.
Zero-point index (what the engine surfaced)
ZPI-ZPI-0007 | 2026-05-10T17:53:50Z
Use a CTE to find the longest chain of referrals in a referrals table.
ZERO POINT — 0 entries (structural invariants)
UNOBSERVED — 0 entries (implied truths)
OBSERVED — 0 entries (explicit in request)
COMPLEXITY │ 0 entries │ spread: 0° │ band: LOW
Baseline response (no ZPI)
```csharp
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
public class Referral
{
public int Id { get; set; }
public int ReferredBy { get; set; }
}
class Program
{
static void Main()
{
var referrals = new List<Referral>
{
new Referral { Id = 1, ReferredBy = null },
new Referral { Id = 2, ReferredBy = 1 },
new Referral { Id = 3, ReferredBy = 2 },
new Referral { Id = 4, ReferredBy = 3 },
new Referral { Id = 5, ReferredBy = 4 },
new Referral { Id = 6, ReferredBy = null },
new Referral { Id = 7, ReferredBy = 6 },
new Referral { Id = 8, ReferredBy = 7 },
new Referral { Id = 9, ReferredBy = 8 },
};
var longestChain = FindLongestChain(referrals);
Console.WriteLine("Longest chain of referrals:");
foreach (var referral in longestChain)
{
Console.WriteLine($"Id: {referral.Id}, ReferredBy: {referral.ReferredBy}");
}
}
static List<Referral> FindLongestChain(List<Referral> referrals)
{
var referralDict = referrals.ToDictionary(r => r.Id, r => r);
var longestChain = new List<Referral>();
var maxLength = 0;
foreach (var referral in referrals)
{
var chain = new List<Referral>();
var currentReferral = referral;
while (currentReferral != null)
{
chain.Add(currentReferral);
currentReferral = referralDict.ContainsKey(currentReferral.ReferredBy) ? referralDict[currentReferral.ReferredBy] : null;
}
if (chain.Count > maxLength)
{
longestChain = chain;
maxLength = chain.Count;
}
}
return longestChain;
}
}
```
Enhanced response (with ZPI)
```csharp
using System;
using System.Data;
using System.Data.SqlClient;
public class ReferralChainFinder
{
public static void FindLongestReferralChain(string connectionString)
{
using (var connection = new SqlConnection(connectionString))
{
connection.Open();
var query = @"
WITH RecursiveReferrals AS (
SELECT ReferrerId, ReferredId, 1 AS Level
FROM Referrals
WHERE ReferrerId IS NOT NULL
UNION ALL
SELECT r.ReferrerId, r.ReferredId, Level + 1
FROM Referrals r
INNER JOIN RecursiveReferrals rr ON r.ReferrerId = rr.ReferredId
)
SELECT MAX(Level) AS LongestChainLength
FROM RecursiveReferrals";
using (var command = new SqlCommand(query, connection))
{
var longestChainLength = (int)command.ExecuteScalar();
Console.WriteLine($"The longest chain of referrals has {longestChainLength} levels.");
}
}
}
public static void Main(string[] args)
{
var connectionString = "Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;";
FindLongestReferralChain(connectionString);
}
}
```
This C# code uses a recursive Common Table Expression (CTE) to find the longest chain of referrals in a referrals table. The `RecursiveReferrals` CTE starts with all referrals where `ReferrerId` is not null, and then recursively joins the `Referrals` table to itself, incrementing the `Level` for each recursive iteration. The `MAX(Level)` is then used to find the longest chain length.
Note: This code assumes that the `Referrals` table has columns `ReferrerId` and `ReferredId`, and that the `ReferrerId` is null for the top-level referrers. The actual column names and database schema may vary.
This implementation genuinely requires more text to explain the recursive CTE and the database query.
Grader chain
Each grader reads the same baseline + enhanced pair and casts an independent verdict. Disagreement is the framework's own signal — not noise to be averaged away.
V1samba/Meta-Llama-3.3-70B-Instruct
BetterV4qwen2.5-coder-3b-instruct
BetterV5openrouter/qwen/qwen3-235b-a22b-2507
BetterV7qwen2.5-coder-7b-instruct
BetterV8openai/gpt-4.1
BetterV9anthropic/claude-opus-4-7
BetterV12openai/gpt-4o
BetterComments
Our grader said what it said. What do you say? Comment as a guest below.
No comments yet. Be the first to say what you make of this round.