/- Copyright (c) 2025 The Compfiles Contributors. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Jeremy Tan -/ import Mathlib.Algebra.Group.Submonoid.Membership import Mathlib.Basic.Real.Sign import Mathlib.GroupTheory.Perm.Sign import Mathlib.Tactic /-! # International Mathematical Olympiad 1997, Problem 3 Let $x_1, x_2, \dots, x_n$ be real numbers satisfying the conditions $|x_1 + x_2 + \cdots + x_n| = 1$ and $|x_i| ≤ \frac{n+1}2$ for $i = 1, 2, \dots, n$. Show that there exists a permutation $y_1, y_2, \dots, y_n$ of $x_1, x_2, \dots, x_n$ such that $|y_1 + 2y_2 + \cdots + ny_n| ≤ \frac{n+1}2$. -/ namespace Imo1997P3 theorem imo1997_p3 {n : ℕ} {x : Fin n → ℝ} (hx₁ : |∑ i, x i| = 1) (hx₂ : ∀ i, |x i| ≤ (n + 1) / 2) : ∃ p : Equiv.Perm (Fin n), |∑ i, (i + 1) * x (p i)| ≤ (n + 1) / 2 := by sorry end Imo1997P3