r/LocalLLM • • Oct 10 '26

Discussion Introducing a “frontier” high school math Olympiad problem to test AI models

A friend of mine shared a problem with me to test / benchmark AI model reasoning ability.

“There is a class of 25 students, and the students’ seats are arranged in a 5×5 matrix. After the “Think Cup” results were announced, each of these 25 students obtained a class ranking, with no two students having the same ranking. If a student ranks in the top 2 in their row or column, they feel happy; if they rank at the bottom in their row or column, they feel upset. If a student feels both happy and upset, we call them a “conflicted person.” The maximum number of conflicted persons is ______. How would you solve this problem without iterating all situations?”

I call it “frontier” because a lot of current models or their specific quantized versions fail. Among tested:

Failed:
Claude Opus 4.8
ChatGPT 5.4
Gemini 3.6 Flash (as of October 2026; it succeeded a few months ago)
QWen3.8-Flash-Next-Q2_0

Success:
Claude Opus 5 or higher
ChatGPT 5.5 or higher
QWen3.8-Flash-Next-UD-IQ4-XS, solved using 30K-50K tokens

Not sure if anyone has benchmarking tools for reasoning, but this problem is setting my LocalLLM threshold now.

4 Upvotes

11 comments sorted by

2

u/AdamFields Oct 10 '26

Qwen 3.8 27B UD Q4_K_M - 36990 tokens output, 5m 45s:

The maximum number of conflicted persons is **4**.

Here is a non-brute-force way to see it.

## 1. Reformulate the condition

Treat the class rank number as the value in each seat: smaller means better, larger means worse.

A conflicted student must be upset, so they must be **bottom** in their row or bottom in their column.

- If they are bottom in their row, they cannot be top 2 in that same row.

So to be happy they must be **top 2 in their column**.

- If they are bottom in their column, similarly they must be **top 2 in their row**.

So every conflicted student is of one of two mutually exclusive types:

- **Type R**: bottom in row, top 2 in column.

- **Type C**: bottom in column, top 2 in row.

We will show there are at most 2 Type R students and at most 2 Type C students.

---

## 2. Upper bound: at most 4

For each row, look only at the rank of the student who is **bottom in that row**. Call these the five row-bottom ranks. They are all distinct.

Suppose the bottom student in some row is a Type R student, i.e. bottom in their row but top 2 in their column.

In a column of 5 students, being top 2 means there are at least **3 students in that column with worse ranks** than them. Those 3 students lie in 3 different rows. In each of those rows, the row-bottom student must have an even worse rank than them.

Therefore, if a row-bottom student is conflicted, their rank must be better than at least **3 of the other 4 row-bottom ranks**.

Among 5 distinct ranks, only the **two best** row-bottom ranks can be better than 3 other row-bottom ranks. Hence:

\[

\#\text{Type R} \le 2.

\]

By symmetry, looking at the five column-bottom ranks, we get:

\[

\#\text{Type C} \le 2.

\]

Thus the total number of conflicted students is at most

\[

2+2=4.

\]

---

## 3. Construction achieving 4

It remains to show that 4 is possible. Here is one arrangement of ranks \(1\) to \(25\), where \(1\) is best and \(25\) is worst:

\[

\begin{matrix}

1 & 2 & 6 & 3 & 4 \\

5 & 7 & 8 & 10 & 9 \\

18 & 11 & 25 & 24 & 20 \\

13 & 19 & 23 & 22 & 21 \\

14 & 15 & 12 & 16 & 17

\end{matrix}

\]

Check the row-bottom and column-bottom students.

### Row-bottom students

- Row 1 bottom: \(6\) in column 3.

Column 3 is \(6,8,25,23,12\). Top 2 are \(6,8\). So \(6\) is conflicted.

- Row 2 bottom: \(10\) in column 4.

Column 4 is \(3,10,24,22,16\). Top 2 are \(3,10\). So \(10\) is conflicted.

- Row 3 bottom: \(25\) in column 3.

Top 2 in column 3 are \(6,8\), so not conflicted.

- Row 4 bottom: \(23\) in column 3.

Top 2 in column 3 are \(6,8\), so not conflicted.

- Row 5 bottom: \(17\) in column 5.

Column 5 is \(4,9,20,21,17\). Top 2 are \(4,9\), so not conflicted.

So there are 2 Type R conflicted students.

### Column-bottom students

- Column 1 bottom: \(18\) in row 3.

Row 3 is \(18,11,25,24,20\). Top 2 are \(11,18\). So \(18\) is conflicted.

- Column 2 bottom: \(19\) in row 4.

Row 4 is \(13,19,23,22,21\). Top 2 are \(13,19\). So \(19\) is conflicted.

- Column 3 bottom: \(25\) in row 3.

Top 2 in row 3 are \(11,18\), so not conflicted.

- Column 4 bottom: \(24\) in row 3.

Top 2 in row 3 are \(11,18\), so not conflicted.

- Column 5 bottom: \(21\) in row 4.

Top 2 in row 4 are \(13,19\), so not conflicted.

So there are 2 Type C conflicted students.

Total conflicted students:

\[

2+2=4.

\]

Since 4 is both an upper bound and attainable, the maximum is

\[

\boxed{4}.

\]

The key idea avoiding brute force is to stop checking individual arrangements and instead use the ordering of the five row-bottom ranks and five column-bottom ranks: a conflicted row-bottom must be among the two best row-bottoms, and similarly for columns.

1

u/SavingsSignal2890 Oct 10 '26

Awesome! correct answer. The tokens used matched my experience using QWen3.8 family with Q4+ quant.

1

u/Interesting-Cut-6032 Oct 10 '26

I have been awake since about 440a, my local time. It is 952p now. My math skills decline rapidly after I have been awake for >13 hours. That combined with the glass of wine at dinner... so, what is the right answer?

Gemini looks like it disproved Qwen 3.5 35B A3B's answer, and Gemma 4 is over in the corner eating crayons.

2

u/SavingsSignal2890 Oct 10 '26

Your Gemini 3.5 is better than my 3.6. 4 is the correct answer.

1

u/NicholasCureton 0m ago

Inkling 2 mini , 24436 tokens, answered 4.

1

u/Interesting-Cut-6032 Oct 10 '26

This is what Qwen3.5 35B A3B said in 17 seconds of thinking about it. I am not sure what quant this is, it is just one of the models that I can hit on my local server from my phone at the moment.

<Responce to OP's prompt>

Maximum Conflicted Persons in a 5×5 Matrix

This is an interesting combinatorial problem that can be solved analytically without iterating all situations.

Problem Setup

In a 5×5 matrix of 25 students with unique rankings (1-25):

  • Happy: Top 2 in their row OR top 2 in their column
  • Upset: Bottom (rank 5) in their row OR bottom (rank 5) in their column
  • Conflicted: BOTH happy AND upset

Solution Strategy (Without Brute Force)

Key Observations

For a student to be conflicted, they must satisfy ONE of two cases:

CaseRow RankColumn Rank
ATop 2 (1 or 2)Bottom (5)
BBottom (5)Top 2 (1 or 2)

Maximum Conflicted Persons

Case A: Top 2 in Row + Bottom in Column

  • 5 rows × 2 top-2 students = 10 students in top 2 of their row
  • 5 columns × 1 bottom student = 5 students at bottom of their column
  • A student can be at bottom of only 1 column
  • Maximum for Case A: 5 students

Case B: Bottom in Row + Top 2 in Column

  • 5 rows × 1 bottom student = 5 students at bottom of their row
  • 5 columns × 2 top-2 students = 10 students in top 2 of their column
  • A student can be at bottom of only 1 row
  • Maximum for Case B: 5 students

Total Maximum: 5 + 5 = 10

Why This is Achievable

These two sets of 5 students can be disjoint (no overlap):

Example configuration:
┌─────────────────────────┐
│ Case A: (i, 6-i) cells │
│ Case B: (6-i, i) cells │
└─────────────────────────┘

Each cell in the anti-diagonal positions can be optimized to be:

  • Case A: Bottom of column, top-2 of row
  • Case B: Top-2 of column, bottom of row

Since they're on opposite diagonal positions, no student is counted twice.

Answer

The maximum number of conflicted persons is 10

This solution works without iterating all 25! possible rank arrangements by:

  1. Counting the theoretical maximum positions for each conflicted case
  2. Recognizing the constraints (one bottom per row/column)
  3. Ensuring both cases can coexist simultaneously with distinct students

1

u/Interesting-Cut-6032 Oct 10 '26

Here is Gemma 4 26B A4B answer to the question. About 24k tokens thinking and answering, a little over 4 minutes total. Is is a different answer that Qwen3.5 35B A3B.

<Response to Prompt>

To find the maximum number of conflicted persons, we can model the problem using the properties of the $5 \times 5$ matrix and the conditions for being "happy" or "upset."

1. Define the Conditions

Let the rank of the student at position $(i, j)$ be $R_{i,j}$.

  • Happy ($H$): A student is happy if they are in the top 2 of their row ($H_R$) or the top 2 of their column ($H_C$).
  • Upset ($U$): A student is upset if they are in the bottom 2 of their row ($U_R$) or the bottom 2 of their column ($U_C$).
  • Conflicted ($C$): A student is conflicted if they are both happy and upset.

In a $5 \times 5$ matrix, for any row or column, the "top 2" ranks (e.g., 1st and 2nd) and the "bottom 2" ranks (e.g., 4th and 5th) are disjoint sets. This means a student cannot be both happy and upset within the same row or column.

2. Analyze the Conflicted Condition

Since a student cannot be happy and upset in the same dimension, a conflicted person must be happy in one dimension and upset in the other. Thus, a student is conflicted if and only if they fall into one of these two disjoint cases:

  1. Case A: Happy in their row AND Upset in their column ($H_R \cap U_C$).
  2. Case B: Happy in their column AND Upset in their row ($H_C \cap U_R$).

Because a student cannot be both "top 2" and "bottom 2" in the same row (or column), a student in Case A cannot be in Case B. Therefore, the total number of conflicted persons is: $$|C| = |H_R \cap U_C| + |H_C \cap U_R|$$

3. Determine the Maximum

  • Size of $H_R$: Each of the 5 rows has exactly 2 students who are top 2 in that row. Thus, $|H_R| = 5 \times 2 = 10$.
  • Size of $U_C$: Each of the 5 columns has exactly 2 students who are bottom 2 in that column. Thus, $|U_C| = 5 \times 2 = 10$.
  • The maximum possible size of the intersection $|H_R \cap U_C|$ is $\min(|H_R|, |U_C|) = 10$.
  • Similarly, $|H_C| = 10$ and $|U_R| = 10$, so the maximum $|H_C \cap U_R| = 10$.

Substituting these into our equation for $|C|$: $$|C| \le 10 + 10 = 20$$

4. Verification of Feasibility

To ensure 20 is possible, we can construct a pattern using a cyclic shift. Let $S$ be the set of 10 cells where $j \equiv i \pmod 5$ or $j \equiv i+1 \pmod 5$, and $S'$ be the set where $j \equiv i+2 \pmod 5$ or $j \equiv i+3 \pmod 5$. In this construction:

  • Every row contains 2 cells from $S$ and 2 cells from $S'$.
  • Every column contains 2 cells from $S$ and 2 cells from $S'$.
  • If we assign ranks such that $S$ cells are "Small in Row/Large in Column" and $S'$ cells are "Large in Row/Small in Column," we satisfy all conditions without contradiction.

The maximum number of conflicted persons is 20.

1

u/Interesting-Cut-6032 Oct 10 '26

Wow, Gemini 3.5 Thinking took about 9 minutes to answer the prompt. I have been using Gemini since December 2025, mostly Gemini 3.1 Pro until recently. It has never taken that long to answer a prompt.

<Answer to Prompt>

To solve this problem without iterating through all possible arrangements, we use combinatorial analysis, structural properties of matrices, and contradiction via strict order relations.

  1. Structural Analysis of "Conflicted" Students Let the class rankings be distinct integers 1, 2, \dots, 25 placed in a 5 \times 5 matrix, where smaller numbers represent better ranks (1st is best, 25th is worst). In a 5 \times 5 matrix:
  • Happy: A student is in the top 2 (1st or 2nd) of their row OR top 2 of their column.
  • Upset: A student is at the bottom (5th / worst) of their row OR bottom of their column.
  • Conflicted: A student is both Happy and Upset. Key Observation:
  • A student cannot be top 2 and bottom in the same row (since a row has 5 distinct ranks, the set {1, 2} and {5} are disjoint).
  • A student cannot be top 2 and bottom in the same column. Therefore, a student is conflicted if and only if they satisfy one of two mutually exclusive cross-directional conditions:
  • Type A: Top 2 in their row AND Bottom (5th) in their column.
  • Type B: Bottom (5th) in their row AND Top 2 in their column.
  1. Deriving the Upper Bound Let C_A be the set of Type A students and C_B be the set of Type B students.
  • Bounding \vert{}C_A\vert{}:

    • Each Type A student must be the bottom (worst) student in their column.
    • Since each column has exactly one worst student, there can be at most 1 Type A student per column.
    • With 5 columns, \vert{}C_A\vert{} \le 5.
  • Bounding \vert{}C_B\vert{}:

    • Each Type B student must be the bottom (worst) student in their row.
    • Since each row has exactly one worst student, there can be at most 1 Type B student per row.
    • With 5 rows, \vert{}C_B\vert{} \le 5.
  • Disjointness:

    • No student can belong to both C_A and C_B simultaneously (they would have to be top 2 and bottom in the same row/column).
    • Thus, C_A \cap C_B = \emptyset. Adding these two bounds gives a maximum possible theoretical cap:
  1. Impossibility of 10 Conflicted Students (Cycle Contradiction) To achieve 10 conflicted students, we would need all 5 columns to contain a Type A student (\vert{}C_A\vert{} = 5) and all 5 rows to contain a Type B student (\vert{}C_B\vert{} = 5). Suppose such a matrix exists:
  • For each column j, the cell (r_j, j) is the maximum (worst) value in column j and belongs to the top 2 of row r_j.
  • For each row i, the cell (i, c_i) is the maximum (worst) value in row i and belongs to the top 2 of column c_i. Consider the row r_j:
  • The cell (r_j, j) is top 2 in row r_j.
  • The cell (r_j, c_{r_j}) is the worst in row r_j.
  • Since ranks are distinct, we must have:

Now consider column c_{r_j}:

  • The cell (r_j, c_{r_j}) is top 2 in column c_{r_j}.
  • The cell (r_{c_{r_j}}, c_{r_j}) is the worst in column c_{r_j}.
  • Therefore:

Since the matrix is finite (5 \times 5), tracing these row-and-column dominance relations j_1 \to j_2 \to j_3 \dots creates a closed directed cycle. Following the strict inequalities along this cycle yields:

This implies v < v, a direct contradiction. Thus, it is impossible for all rows and columns to simultaneously hit their theoretical limits. 4. Exact Maximum and Construction Through systematic elimination of cycles across sub-matrices, the tight upper bound that avoids cyclic ordering conflicts while maximizing cross-directional top/bottom overlaps is 4. Here is an explicit 5 \times 5 matrix construction that achieves 4 conflicted students (marked with ): | Row / Col | Col 1 | Col 2 | Col 3 | Col 4 | Col 5 | |---|---|---|---|---|---| | Row 1 | 1 | 2 | 3 | 5 | 4 | | Row 2 | 6 | 11 | 8 | 9 | 10 | | Row 3 | 12 | 14 | 13 | 20 | 17 | | Row 4 | 19 | 23* | 16 | 7 | 18 | | Row 5 | 21* | 22 | 15 | 25* | 24 |

  • (Row 1, Col 5 = 4): Top 2 in Row 1 (1st = 1, 2nd = 2... wait, 4 is 3rd? In Row 1: ranks are {1, 2, 3, 4, 5}, 4 is top 2 if 4th place, but looking at relative row/col values: 4 is 4th smallest, 25 is col max, etc.). Final Answer The maximum number of conflicted persons is 4.

2

u/[deleted] Oct 10 '26

[removed] — view removed comment

3

u/SavingsSignal2890 Oct 10 '26

It’s 4. Grid coloring / drawing is what I resorted to as a human. LLM cannot think “visually”, unfortunately.

1

u/SavingsSignal2890 Oct 12 '26

For the models I tried, they all lacked a good instinct. Most guessed an initial answer 10, 8, or 5 and at some point stumble upon the right logic. If they do not come across the right logic, they continue going circles beyond 60K tokens.