| TeamsCode 2026 Spring Contest |
|---|
| Закончено |
You are given a rectangular grid (0-indexed) $$$A$$$ with $$$N$$$ rows and $$$M$$$ columns, in which $$$A_{i, j} \gt A_{i + 1, j}$$$ and $$$A_{i, j} \gt A_{i, j + 1}$$$. Consider an undirected graph with $$$(NM)^K$$$ vertices represented as a tuple $$$(P_1, P_2, \dots, P_K)$$$, where $$$P_x$$$ represents some position $$$(i, j)$$$ $$$(0 \leq i \lt N, 0 \leq j \lt M)$$$. Vertices $$$(P_1, P_2, \dots, P_K)$$$ and $$$(Q_1, Q_2, \dots, Q_K)$$$ are connected by an edge if the following two conditions are satisfied:
The first line contains $$$3$$$ positive integers $$$N$$$, $$$M$$$, and $$$K$$$ $$$(1 \leq NM \leq 4 \cdot 10^6, 1 \leq K \leq 10^9)$$$.
The next $$$N$$$ lines contain $$$M$$$ integers representing $$$A_{i, j}$$$ $$$(0\leq A_{i, j} \leq 10^9, A_{i, j} \gt A_{i + 1, j}, A_{i, j} \gt A_{i, j + 1})$$$.
—
Tests in subtasks are numbered from $$$1−20$$$ with samples skipped. Each test is worth $$$\frac{100}{20}=5$$$ points.
Test $$$1$$$ satisfies $$$K = 1$$$.
Tests $$$2-4$$$ satisfy $$$N, M \leq 20, K \leq 3$$$.
Tests $$$5-12$$$ satisfy $$$N, M \leq 300$$$.
Tests $$$13-15$$$ satisfy $$$N, M \leq 2000$$$.
Tests $$$16-17$$$ satisfy $$$NM \leq 2 \cdot 10^5$$$.
Tests $$$18-20$$$ satisfy no additional constraints.
Output $$$1$$$ integer, the maximum total weight of the vertices in an independent set of the graph modulo $$$998244353$$$.
2 2 12 11 0
17
2 2 22 11 0
67073
3 3 34 3 23 2 12 1 0
189222073
—
Problem Idea: HaccerKat
Problem Preparation: HaccerKat
Occurrences: Advanced M
| Название |
|---|


