結果
| 問題 |
No.3068 Speedrun (Hard)
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2025-03-21 23:00:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,225 bytes |
| コンパイル時間 | 3,930 ms |
| コンパイル使用メモリ | 275,048 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-21 23:00:55 |
| 合計ジャッジ時間 | 13,175 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 WA * 14 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:36:37: warning: ‘y’ may be used uninitialized [-Wmaybe-uninitialized]
36 | if (0<=x && x<=a[0] && 0<=y && y<=a[1]){
| ~~~~~~~~~~~~~~~~^~~~~~~
main.cpp:13:27: note: ‘y’ was declared here
13 | int N, a[4], b[4], x, y, T, S, M;
| ^
ソースコード
#include <bits/stdc++.h>
//#include <atcoder/modint>
using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint998244353;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int N, a[4], b[4], x, y, T, S, M;
for (int i=0; i<4; i++) cin >> a[i];
cin >> N;
for (int i=0; i<4; i++) cin >> b[i];
cin >> T;
for (int i=0; i<=a[2]; i++){
for (int j=0; j<=a[3]; j++){
S = T-b[2]*i-b[3]*j;
M = N-i-j;
if (S < 0 || M < 0) continue;
if (b[0] != b[1]){
if ((S-M*b[0]) % (b[1]-b[0]) != 0) continue;
y = (S-M*b[0])/(b[1]-b[0]);
x = M-y;
if (0<=x && x<=a[0] && 0<=y && y<=a[1]){
cout << x << " " << y << " " << i << " " << j << endl;
return 0;
}
}
else{
if (S/b[0] != M) continue;
x = min(M, a[0]);
if (0<=x && x<=a[0] && 0<=y && y<=a[1]){
cout << x << " " << y << " " << i << " " << j << endl
;
return 0;
}
}
}
}
return 0;
}
srjywrdnprkt