結果
| 問題 |
No.3023 Utility is Max?
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-04-17 06:54:03 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 945 bytes |
| コンパイル時間 | 3,453 ms |
| コンパイル使用メモリ | 273,880 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-04-17 06:54:13 |
| 合計ジャッジ時間 | 10,153 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 WA * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int Q;
cin >> Q;
while(Q--){
int64 I;
cin >> I;
int64 A1,B1,X1,Y1;
int64 A2,B2,X2,Y2;
cin >> A1 >> B1 >> X1 >> Y1
>> A2 >> B2 >> X2 >> Y2;
int64 cost1 = A1*X1 + B1*Y1;
int64 cost2 = A2*X2 + B2*Y2;
// 1.予算全額使い切りの確認
if(cost1 != I || cost2 != I){
cout << "No\n";
continue;
}
// 2.相互に購入可能にならないこと(WARP回避)
int64 cross12 = A1*X2 + B1*Y2; // 店1で bundle2 が買えるか
int64 cross21 = A2*X1 + B2*Y1; // 店2で bundle1 が買えるか
if(cross12 <= I && cross21 <= I){
cout << "No\n";
} else {
cout << "Yes\n";
}
}
return 0;
}