結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー |
![]() |
提出日時 | 2022-12-23 23:10:29 |
言語 | C++14 (gcc 11.2.0 + boost 1.78.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,182 bytes |
コンパイル時間 | 3,104 ms |
使用メモリ | 134,888 KB |
最終ジャッジ日時 | 2022-12-23 23:10:38 |
合計ジャッジ時間 | 7,842 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,948 KB |
testcase_01 | AC | 1 ms
4,904 KB |
testcase_02 | AC | 11 ms
6,952 KB |
testcase_03 | TLE | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
testcase_54 | -- | - |
testcase_55 | -- | - |
testcase_56 | -- | - |
testcase_57 | -- | - |
testcase_58 | -- | - |
testcase_59 | -- | - |
testcase_60 | -- | - |
testcase_61 | -- | - |
testcase_62 | -- | - |
testcase_63 | -- | - |
testcase_64 | -- | - |
testcase_65 | -- | - |
testcase_66 | -- | - |
testcase_67 | -- | - |
testcase_68 | -- | - |
testcase_69 | -- | - |
testcase_70 | -- | - |
testcase_71 | -- | - |
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内: main.cpp:30:14: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ 30 | auto [cost,now]=q.top(); | ^
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define rep(i,n) for(int i=0;i<(n);i++) #define per(i,n) for(int i=(n)-1;i>=0;i--) #define all(x) x.begin(),x.end() typedef long long ll; //using mint = modint; using mint = modint998244353; //using mint = modint1000000007; using P = pair<int, int>; const ll INF=1LL<<60, dx[]={0,1,0,-1},dy[]={1,0,-1,0}; template <typename T> inline bool chmin(T& a,const T&b) {if(a>b){a=b; return 1;} return 0;} template <typename T> inline bool chmax(T& a,const T&b) {if(a<b){a=b; return 1;} return 0;} int main(){ ll T,X,A,Y,B; cin >> T; cin >> X >> A; cin >> Y >> B; map<ll,ll> mp; priority_queue<pair<ll,ll>,vector<pair<ll,ll>>, greater<pair<ll,ll>>> q; q.push({1ll,0ll}); while(!mp[T]) { auto [cost,now]=q.top(); q.pop(); //cout << "##" << cost << " " << now << endl; if(!mp[now]) { mp[now]=cost; if(!mp[now+1]) q.push({cost+1,now+1}); if(!mp[now+A]) q.push({cost+X,now+A}); if(!mp[now-B]) q.push({cost+Y,now-B}); } } cout << mp[T]-1 << endl; return 0; }