結果

問題 No.2057 Ising Model
ユーザー t98slider
提出日時 2022-08-26 22:06:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 1,581 ms
コンパイル使用メモリ 165,772 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 22:43:03
合計ジャッジ時間 13,934 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 14 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll n, a, b, c1, c2, ans = 1ll << 62;
    cin >> n >> a >> b;
    c1 = n / 2, c2 = n - c1;
    int r = n / 2;
    for(ll i = 0; i <= r; i++){
        ll d = min(i << 1, n - 1);
        ans = min(ans, a * (- (d << 1) + n - 1) + b * (-n + (i << 1)));
    }
    cout << ans << '\n';
}
0