結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー |
![]() |
提出日時 | 2022-10-15 13:59:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 751 bytes |
コンパイル時間 | 990 ms |
コンパイル使用メモリ | 101,028 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 19:46:05 |
合計ジャッジ時間 | 4,450 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 59 WA * 13 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <set> #include <random> #include <iomanip> using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) template<class T> using vi = vector<T>; template<class T> using vii = vector<vi<T>>; template<class T> using viii = vector<vii<T>>; int main() { ll t, x, a, y, b; cin >> t >> x >> a >> y >> b; ll base = 0; if (t < 0) { ll ny = (-t - 1) / b + 1; t += b * ny; base += y * ny; } ll ans = 1e18; for (ll ny = 0; ny < x; ny++) {//yの回数 ll now = - b * ny; ll nx = (t - now) / a; ll res = y * ny + x * nx + (t - now - a * nx); ans = min(ans, res); } cout << ans + base << endl; return 0; }