結果

問題 No.555 世界史のレポート
ユーザー parukiparuki
提出日時 2017-08-11 23:05:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,242 bytes
コンパイル時間 2,014 ms
コンパイル使用メモリ 163,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 23:24:51
合計ジャッジ時間 2,752 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define rt return
using dbl = double;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const ll INF = LLONG_MAX / 3;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, C, V;
    cin >> N >> C >> V;
    ll ini = C + V;// 2
    ll ans = INF;
    for (int i = 1; i <= 20; ++i) {
        // cp, p, cp
        if (i == 1) {
            smin(ans, (N - 2ll)*V + ini);
        } else {
            // コピペ * i
            ll x = (C + V)*i;
            if ((1 << i) >= N) {
                smin(ans, x);
                continue;
            }
            ll y = N - (1ll << i);
            
            ll z = 1ll << (i - 1);
            ll w = (y + z - 1) / z * V;
            smin(ans, x + w);
        }
    }
    cout << ans << endl;
}
0