結果

問題 No.555 世界史のレポート
ユーザー uenokuuenoku
提出日時 2017-08-14 00:44:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,136 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 103,664 KB
実行使用メモリ 207,000 KB
最終ジャッジ日時 2024-04-21 10:34:32
合計ジャッジ時間 7,364 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 4 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 423 ms
52,556 KB
testcase_11 AC 278 ms
27,852 KB
testcase_12 AC 624 ms
101,840 KB
testcase_13 AC 914 ms
101,836 KB
testcase_14 TLE -
testcase_15 AC 67 ms
9,424 KB
testcase_16 AC 270 ms
27,980 KB
testcase_17 AC 81 ms
15,820 KB
testcase_18 AC 324 ms
52,308 KB
testcase_19 AC 399 ms
52,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "math.h"
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ifor(i, a, b) for (lli i = (a); i < (b); i++)
#define rfor(i, a, b) for (lli i = (b)-1; i >= (a); i--)
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
typedef long double ld;
using lli = long long int;
int main()
{
    lli n, c, v;
    cin >> n >> c >> v;
    using p = pair<lli, pair<lli, lli>>;
    priority_queue<p, vector<p>, greater<p>> que;
    que.push(make_pair(0, make_pair(1, 0)));
    while (true) {
        auto t = que.top();
        que.pop();
        auto C = t.first;

        auto len = t.second.first;

        if (len >= n) {
            cout << C << endl;
            return 0;
        }
        auto buf = t.second.second;

        //cout << C << " " << len << " " << buf << endl;
        if (buf < len)
            que.push(make_pair(C + c, make_pair(len, len)));
        que.push(make_pair(C + v, make_pair(len + buf, buf)));
    }
}
0