No.2057 Ising Model
レベル :
/ AI推定難易度 : 1100
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 129
作問者 :
taiga0629kyopro
/ テスター :
nok0
ygussany
タグ : / 解いたユーザー数 129
作問者 :
taiga0629kyopro
/ テスター :
nok0
問題文最終更新日: 2022-08-25 22:24:36
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 358
(順位表)
の他の問題:
Problem Statement
You are given positive integers $N,A,B$. A sequence $S$ of length $N$ is called a good sequence if $S_i \in \lbrace -1,1 \rbrace$ holds for every integer $i$ satisfying $1 \le i \le N$. For a good sequence $S$, define $f(S)$ as follows.
$f(S)= A \displaystyle \sum_{i=1}^{N-1} S_iS_{i+1}-B \displaystyle \sum_{i=1}^N S_i$
Find the minimum value of $f(S)$.
Input
$N$ $A$ $B$
Output
Output the minimum value of $f(S)$.
Sample
Sample 1
Input
3 2 1
Output
-5
Setting $S=(1,-1,1)$ is optimal.
Sample 2
Input
10 3 6
Output
-33
Sample 3
Input
666 222 999
Output
-517704
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。