結果

問題 No.3068 Speedrun (Hard)
ユーザー hiromi_ayase
提出日時 2025-03-21 22:08:18
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,234 bytes
コンパイル時間 5,948 ms
コンパイル使用メモリ 332,164 KB
実行使用メモリ 28,160 KB
最終ジャッジ日時 2025-03-21 22:08:45
合計ジャッジ時間 22,795 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other AC * 8 WA * 14 RE * 6 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO                \
  ios::sync_with_stdio(false); \
  cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;

bitset<200000001> b;

int main() {
  FAST_IO
  auto ans = 0LL;

  vector<pair<i64, i64>> a(4);
  for (auto& [x, y] : a) cin >> x;
  i64 N;
  cin >> N;

  for (auto& [x, y] : a) cin >> y;
  i64 T;
  cin >> T;

  for (int i = 0; i <= a[0].first; i ++) {
    for (int j = 0; j <= a[1].first; j ++) {
      auto x = i * a[0].second + j * a[1].second;
      b[x] = true;
    }
  }

  for (int i = 0; i <= a[2].first; i ++) {
    for (int j = 0; j <= a[3].first; j ++) {
      auto x = i * a[2].second + j * a[3].second;
      auto y = T - x;

      if (b[y]) {
        for (int i2 = 0; i2 < a[0].first; i2 ++) {
          for (int j2 = 0; j2 < a[1].first; j2 ++) {
            if (x + i2 * a[0].second + j2 * a[1].second == T) {
              cout << i2 << " " << j2 << " " << i << " " << j << endl;
              return 0;
            }
          }
        }
      }
    }
  }

  cout << -1 << endl;
}
0