NIKKEI Programming Contest 2019-2 Task E. Non-triangular Triplets

$\require{enclose}$
# 必要条件 一方面 $\sum\_{i=1}^{N}(a_i + b_i) \le \sum\_{i=1}^{N} c_i \implies 2\sum\_{i=1}^{N} c_i \ge \sum\_{i=1}^{N}(a_i + b_i + c_i) = \sum\_{i=K}^{K+3N-1} i = \frac{3N(2K+3N-1)}{2}$ 另一方面 $\sum\_{i=1}^{N} c_i \le \sum_{i=K+2N}^{K+3N-1} i = \frac{N(2K+5N-1)}{2}$ $N(2K+5N-1) \le \frac{3N(2K+3N-1)}{2} \implies 2K - 1\le N$

此必要条件也可用另一种方法推导出来:
由于 $\sum_{i = 1}^{N} (a_i + b_i) \ge \sum_{i=K}^{K+2N-1} i $ 且 \(\sum_{i=1}^{N} c_i \le \sum_{i = K+2N}^{K+3N-1} i\),因此 \(\sum_{i = 1}^{N} (a_i + b_i) \le \sum_{i=1}^{N} c_i \implies \sum_{i=K}^{K+2N-1} i \le \sum_{i = K+2N}^{K+3N-1} i \implies 2K - 1\le N\)

构造

the pattern is \((x, y)\), \((x+2, y -1)\), ...

例子
\(K = 2, N = 6\)
\begin{matrix}
3 & 5 & \enclose{right}{7} & 2 & 4 & 6 \\
10 & 9 & \enclose{right}{8} & 13 &12 & 11 \\
\hline
14 & 15 & 16 & 17 & 18 & 19
\end{matrix}
\(K = 2, N = 7\)
\begin{matrix}
2 & 4 & 6 & 8 & 3 & 5 & 7 \\
15 & 14 & 13 & 12 & 11 & 10 & 9 \\
\hline
19 & 20 & 21 & 22 & 16 & 17 & 18
\end{matrix}

posted @ 2019-11-13 07:46  Pat  阅读(197)  评论(0编辑  收藏  举报