結果
問題 |
No.3068 Speedrun (Hard)
|
ユーザー |
![]() |
提出日時 | 2025-03-21 22:14:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 2,210 ms |
コンパイル使用メモリ | 194,176 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-21 22:14:36 |
合計ジャッジ時間 | 12,294 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 RE * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int a,b,c,d,n,p,q,r,s,t; cin>>a>>b>>c>>d>>n>>p>>q>>r>>s>>t; for(int i=0;i<=a;i++)for(int j=0;j<=b;j++){ int lt = t-i*p-j*q; int ln = n-i-j; if(lt < 0 && ln < 0) break; // x+y = ln; swap(t,s); swap(s,r); // sx+ty = lt; // sx+sy = s*ln; // y = (lt-s*ln)/(t-s) // x = ln-y int y = (lt-s*ln)/(t-s); int x = ln-y; if(y*(t-s) != (lt-s*ln) || y < 0 || x < 0 || y > d || x > c){ swap(s,r); swap(t,s); continue; } cout<<i<<' '<<j<<' '<<x<<' '<<y<<endl; return 0; } }