結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
|
提出日時 | 2025-03-22 00:26:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,249 bytes |
コンパイル時間 | 3,871 ms |
コンパイル使用メモリ | 252,196 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-22 00:26:45 |
合計ジャッジ時間 | 13,473 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 31 WA * 1 |
ソースコード
#include <atcoder/all> #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template <typename T> bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template <typename T> bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct IOST { IOST() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20); } } IOST; using mint = atcoder::modint998244353; int main(){ ll n,t; vector<ll> a(4),b(4); rep(i,0,4) cin>>a[i]; cin>>n; rep(i,0,4) cin>>b[i]; cin>>t; int flg=0; if(b[2]<b[3]){ swap(b[2],b[3]); swap(a[2],a[3]); flg=1; } rep(x,0,a[0]+1) rep(y,0,a[1]+1){ ll nn=n-x-y; if(nn<0) break; ll tt=t-b[0]*x-b[1]*y; if(tt<0) break; if(b[2]==b[3]){ if(b[2]*nn!=tt) continue; ll ct=tt/b[2]; if(ct>a[2]+a[3]) continue; ll tmp=min(ct,a[2]); if(flg) tmp=ct-tmp; cout<<x<<" "<<y<<" "<<tmp<<" "<<ct-tmp<<"\n"; return 0; }else{ tt-=b[3]*nn; if(t<0) continue; ll d=b[2]-b[3]; if(tt%d!=0) continue; ll ct=tt/d; if(ct>a[2]||nn-ct>a[3]) continue; if(flg) ct=nn-ct; cout<<x<<" "<<y<<" "<<ct<<" "<<nn-ct<<"\n"; return 0; } } }