提出 #25250197


ソースコード 拡げる

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <vector>

using usize = size_t;

int main(void) {
  // input
  usize N, X, Y;
  std::cin >> N >> X >> Y;
  int64_t B, C;
  std::cin >> B >> C;
  if (B < C) {
    std::swap(X, Y);
    std::swap(B, C);
  }
  std::vector<int64_t> A(N);
  for (auto &a : A)
    std::cin >> a;

  // solve
  std::sort(A.begin(), A.end());
  for (usize i = 0; i < X; ++i)
    A[i] += B;
  std::sort(A.begin(), A.end());
  for (usize i = 0; i < Y; ++i)
    A[i] += C;

  // output
  std::cout << *std::max_element(A.begin(), A.end()) -
                   *std::min_element(A.begin(), A.end())
            << std::endl;
}

提出情報

提出日時
問題 H - Marbles and Boxes
ユーザ Cyanmond
言語 C++ (GCC 9.2.1)
得点 500
コード長 718 Byte
結果 AC
実行時間 147 ms
メモリ 5080 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 500 / 500
結果
AC × 2
AC × 52
セット名 テストケース
Sample example0.txt, example1.txt
All Xzero0.txt, Xzero1.txt, Xzero2.txt, Xzero3.txt, Xzero4.txt, Yzero0.txt, Yzero1.txt, Yzero2.txt, Yzero3.txt, Yzero4.txt, example0.txt, example1.txt, hand0.txt, hand1.txt, hand2.txt, killer0.txt, killer1.txt, killer2.txt, killer3.txt, killer4.txt, killer5.txt, killer6.txt, killer7.txt, killer8.txt, killer9.txt, large_random0.txt, large_random1.txt, large_random2.txt, large_random3.txt, large_random4.txt, large_random5.txt, large_random6.txt, large_random7.txt, large_random8.txt, large_random9.txt, maximum0.txt, maximum_random0.txt, maximum_random1.txt, maximum_random2.txt, maximum_random3.txt, maximum_random4.txt, maximum_random5.txt, maximum_random6.txt, maximum_random7.txt, maximum_random8.txt, maximum_random9.txt, minimum0.txt, small_random0.txt, small_random1.txt, small_random2.txt, small_random3.txt, small_random4.txt
ケース名 結果 実行時間 メモリ
Xzero0.txt AC 97 ms 4492 KiB
Xzero1.txt AC 87 ms 4064 KiB
Xzero2.txt AC 67 ms 3960 KiB
Xzero3.txt AC 5 ms 3584 KiB
Xzero4.txt AC 110 ms 4744 KiB
Yzero0.txt AC 34 ms 3468 KiB
Yzero1.txt AC 21 ms 3548 KiB
Yzero2.txt AC 89 ms 4392 KiB
Yzero3.txt AC 81 ms 4128 KiB
Yzero4.txt AC 111 ms 4596 KiB
example0.txt AC 2 ms 3468 KiB
example1.txt AC 2 ms 3624 KiB
hand0.txt AC 2 ms 3460 KiB
hand1.txt AC 2 ms 3520 KiB
hand2.txt AC 49 ms 4856 KiB
killer0.txt AC 139 ms 5068 KiB
killer1.txt AC 144 ms 4924 KiB
killer2.txt AC 147 ms 5028 KiB
killer3.txt AC 137 ms 5004 KiB
killer4.txt AC 146 ms 4984 KiB
killer5.txt AC 134 ms 4860 KiB
killer6.txt AC 145 ms 5072 KiB
killer7.txt AC 141 ms 5028 KiB
killer8.txt AC 142 ms 4980 KiB
killer9.txt AC 140 ms 4972 KiB
large_random0.txt AC 60 ms 3804 KiB
large_random1.txt AC 47 ms 3660 KiB
large_random2.txt AC 59 ms 3800 KiB
large_random3.txt AC 137 ms 5004 KiB
large_random4.txt AC 81 ms 4280 KiB
large_random5.txt AC 101 ms 4392 KiB
large_random6.txt AC 90 ms 4400 KiB
large_random7.txt AC 72 ms 3956 KiB
large_random8.txt AC 71 ms 3868 KiB
large_random9.txt AC 114 ms 4748 KiB
maximum0.txt AC 133 ms 4856 KiB
maximum_random0.txt AC 144 ms 4968 KiB
maximum_random1.txt AC 147 ms 5080 KiB
maximum_random2.txt AC 140 ms 4924 KiB
maximum_random3.txt AC 137 ms 4856 KiB
maximum_random4.txt AC 144 ms 4860 KiB
maximum_random5.txt AC 138 ms 5008 KiB
maximum_random6.txt AC 138 ms 4984 KiB
maximum_random7.txt AC 147 ms 4916 KiB
maximum_random8.txt AC 137 ms 4920 KiB
maximum_random9.txt AC 140 ms 5024 KiB
minimum0.txt AC 2 ms 3548 KiB
small_random0.txt AC 2 ms 3624 KiB
small_random1.txt AC 2 ms 3516 KiB
small_random2.txt AC 3 ms 3600 KiB
small_random3.txt AC 3 ms 3404 KiB
small_random4.txt AC 3 ms 3520 KiB