結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー
提出日時 2022-10-14 21:40:28
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,996 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 116,972 KB
実行使用メモリ 160,628 KB
最終ジャッジ日時 2023-09-08 20:32:57
合計ジャッジ時間 8,991 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
160,612 KB
testcase_01 AC 47 ms
160,428 KB
testcase_02 AC 65 ms
160,584 KB
testcase_03 AC 157 ms
160,312 KB
testcase_04 AC 279 ms
160,312 KB
testcase_05 AC 45 ms
160,424 KB
testcase_06 AC 44 ms
160,452 KB
testcase_07 AC 44 ms
160,356 KB
testcase_08 AC 59 ms
160,424 KB
testcase_09 AC 47 ms
160,408 KB
testcase_10 AC 56 ms
160,352 KB
testcase_11 AC 47 ms
160,312 KB
testcase_12 AC 47 ms
160,424 KB
testcase_13 AC 157 ms
160,336 KB
testcase_14 AC 280 ms
160,376 KB
testcase_15 AC 45 ms
160,404 KB
testcase_16 AC 45 ms
160,348 KB
testcase_17 AC 44 ms
160,404 KB
testcase_18 AC 53 ms
160,308 KB
testcase_19 AC 56 ms
160,340 KB
testcase_20 AC 72 ms
160,340 KB
testcase_21 AC 48 ms
160,396 KB
testcase_22 AC 46 ms
160,320 KB
testcase_23 AC 47 ms
160,424 KB
testcase_24 AC 57 ms
160,404 KB
testcase_25 AC 54 ms
160,316 KB
testcase_26 AC 47 ms
160,356 KB
testcase_27 AC 50 ms
160,348 KB
testcase_28 AC 157 ms
160,356 KB
testcase_29 AC 280 ms
160,476 KB
testcase_30 AC 45 ms
160,548 KB
testcase_31 AC 45 ms
160,316 KB
testcase_32 AC 44 ms
160,404 KB
testcase_33 AC 157 ms
160,616 KB
testcase_34 AC 280 ms
160,312 KB
testcase_35 AC 44 ms
160,312 KB
testcase_36 AC 45 ms
160,308 KB
testcase_37 AC 45 ms
160,336 KB
testcase_38 AC 48 ms
160,424 KB
testcase_39 AC 48 ms
160,320 KB
testcase_40 AC 48 ms
160,356 KB
testcase_41 AC 48 ms
160,396 KB
testcase_42 AC 51 ms
160,372 KB
testcase_43 AC 48 ms
160,312 KB
testcase_44 AC 51 ms
160,476 KB
testcase_45 AC 48 ms
160,424 KB
testcase_46 AC 47 ms
160,324 KB
testcase_47 AC 47 ms
160,308 KB
testcase_48 AC 157 ms
160,356 KB
testcase_49 AC 280 ms
160,400 KB
testcase_50 AC 44 ms
160,312 KB
testcase_51 AC 44 ms
160,360 KB
testcase_52 AC 45 ms
160,472 KB
testcase_53 AC 280 ms
160,344 KB
testcase_54 AC 161 ms
160,304 KB
testcase_55 AC 62 ms
160,304 KB
testcase_56 AC 44 ms
160,320 KB
testcase_57 AC 44 ms
160,316 KB
testcase_58 AC 44 ms
160,472 KB
testcase_59 AC 44 ms
160,308 KB
testcase_60 AC 45 ms
160,404 KB
testcase_61 AC 44 ms
160,408 KB
testcase_62 AC 44 ms
160,348 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdint>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cassert>
using namespace std;
namespace atcoder{};using namespace atcoder;

using ull = uint64_t;
using ll = int64_t;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using ld = long double;
using P = pair<ll,ll>;
using G = vector<vector<int>>;

#ifdef MYDEBUG
template<class C> string join(const C& c){stringstream ss; for(auto it=c.begin(); it!=c.end();it++){ss << *it;if(it!=c.end())ss<<", ";}return ss.str();}
template<class C> ostream &operator<<(ostream &os, const vector<C>& c){for(auto it=c.begin(); it!=c.end();it++){os << *it;if(it!=c.end())os<<", ";}return os;}
#define LO(...) fprintf(stderr, __VA_ARGS__)
#define debug(x) cerr << "\033[33m(line:" << __LINE__ << ") " << #x << ": " << x << "\033[m" << endl
#else
#define LO(...) (void)0
#define debug(x) (void)0
#endif

#define reps(i,a,n) for(ll i##_len = (ll)(n), i = (a); i < i##_len; ++i)
#define rep(i,n) reps(i,0,n)
#define rrep(i,n) reps(i,1,n+1)
#define repd(i,n) for(ll i=n-1;i>=0;i--)
#define rrepd(i,n) for(ll i=n;i>=1;i--)

#define inp(i) ll i; cin >> i;
#define inps(s) string s; cin >> s;
#define inpp(p) cin >> (p).first >> (p).second
#define inpv(v,N) vll v(N);rep(i,N)cin>>v[i];
#define inpg(g,N,M) g.resize(N);rep(i,M){inp(a);inp(b);a--,b--;g[a].push_back(b);g[b].push_back(a);}
#define all(v) begin(v),end(v)
#define YESNO(b) cout<<(b?"YES\n":"NO\n")
#define yesno(b) cout<<(b?"yes\n":"no\n")
#define YesNo(b) cout<<(b?"Yes\n":"No\n")
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define yes cout<<"yes\n"
#define no cout<<"no\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"

#define SP cout << " "
#define ENDL cout << "\n"
#define ou(i) cout << (i)
#define ous(i) cout << (i) << " "
#define oul(i) cout << (i) << "\n"
#define setfp() cout << fixed << setprecision(16)

template<typename C> void ouv(const C &v){for(auto &&e:v){cout << e;if(&e != &v.back()) cout << ' ';}cout << "\n";}
template<typename C> void ouvadd(const C &v){for(auto &&e:v){cout << e+1;if(&e != &v.back()) cout << ' ';}cout << "\n";}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

inline ll lg(ll __n) { return sizeof(ll) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); }

int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};

constexpr ll INF = 1e18;
constexpr ll M = 10050000;

ll dp[20100000];

int main(){
    inp(T);
    inp(X);
    inp(A);
    inp(Y);
    inp(B);
    rep(i,M*2){
        dp[i] = INF;
    }

    ll ans = INF;
    for(ll i = T,f=0; i <= M*2; i+=B,f++){
        ll k = f * Y;
        if(i>=0)
        chmin(ans, k+min(i, i/A*X+i%A));
    }
    oul(ans);

    return 0;
}
0