Submission #65015892


Source Code Expand

#ifndef IO_HPP
#define IO_HPP 1

#include <array>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

namespace io {

void __read(char& c) { std::cin >> c; }
void __read(std::string& s) { std::cin >> s; }

template <typename T>
void __read_real(T& x) {
  std::string s;
  __read(s);
  x = std::stod(s);
}

template <typename T>
void __read_integer(T& x) {
  std::cin >> x;
}

void __read(int& x) { __read_integer(x); }
void __read(unsigned int& x) { __read_integer(x); }
void __read(long& x) { __read_integer(x); }
void __read(unsigned long& x) { __read_integer(x); }
void __read(long long& x) { __read_integer(x); }
void __read(unsigned long long& x) { __read_integer(x); }
void __read(double& x) { __read_real(x); }
void __read(long double& x) { __read_real(x); }

template <class U, class V>
void __read(std::pair<U, V>& p) {
  __read(p.first);
  __read(p.second);
}

template <size_t N = 0, typename T>
void __read_tuple(T& t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto& x = std::get<N>(t);
    __read(x);
    __read_tuple<N + 1>(t);
  }
}
template <class... T>
void __read(std::tuple<T...>& t) {
  __read_tuple(t);
}

template <size_t N = 0, typename T>
void __read(std::array<T, N>& a) {
  for (auto& x : a) {
    __read(x);
  }
}

template <class T>
void __read(std::vector<T>& v) {
  for (auto& x : v) {
    __read(x);
  }
}

void read() {}
template <class H, class... T>
void read(H& h, T&... t) {
  __read(h), read(t...);
}

void __write(const char c) { std::cout << c; }

void __write(const std::string s) {
  for (char c : s) {
    __write(c);
  }
}

void __write(const char* s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; ++i) {
    __write(s[i]);
  }
}

template <typename T>
void __write_integer(T x) {
  std::cout << x;
}

template <typename T>
void __write_real(T x) {
  std::ostringstream oss;
  oss << std::fixed << std::setprecision(15) << double(x);
  std::string s = oss.str();
  __write(s);
}

void __write(int x) { __write_integer(x); }
void __write(unsigned int x) { __write_integer(x); }
void __write(long x) { __write_integer(x); }
void __write(unsigned long x) { __write_integer(x); }
void __write(long long x) { __write_integer(x); }
void __write(unsigned long long x) { __write_integer(x); }
void __write(double x) { __write_real(x); }
void __write(long double x) { __write_real(x); }

template <class U, class V>
void __write(const std::pair<U, V> p) {
  __write(p.first);
  __write(' ');
  __write(p.second);
}

template <size_t N = 0, typename T>
void __write_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) {
      __write(' ');
    }
    const auto x = std::get<N>(t);
    __write(x);
    __write_tuple<N + 1>(t);
  }
}
template <class... T>
void __write(std::tuple<T...> t) {
  __write_tuple(t);
}

template <class T, size_t S>
void __write(const std::array<T, S> a) {
  auto n = a.size();
  for (size_t i = 0; i < n; i++) {
    if (i) {
      __write(' ');
    }
    __write(a[i]);
  }
}

template <class T>
void __write(const std::vector<T> v) {
  auto n = v.size();
  for (size_t i = 0; i < n; i++) {
    if (i) {
      __write(' ');
    }
    __write(v[i]);
  }
}

template <class T>
void __write(const std::set<T> s) {
  __write(std::vector<T>{s.cbegin(), s.cend()});
}

template <class K, class V>
void __write(const std::map<K, V> m) {
  __write(std::vector<std::pair<K, V>>{m.cbegin(), m.cend()});
}

void write() { __write('\n'); }
template <class Head, class... Tail>
void write(Head&& head, Tail&&... tail) {
  __write(head);
  if (sizeof...(Tail)) {
    __write(' ');
  }
  write(std::forward<Tail>(tail)...);
}

}  // namespace io

#endif  // IO_HPP

#ifdef ONLINE_JUDGE
#include <bits/allocator.h>
#pragma GCC optimize("Ofast,unroll-loops,inline")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#endif

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
// using namespace atcoder;
using namespace io;

template <typename T>
using ordered_set =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
  int n, x;
  read(n, x);
  vector<tuple<int, int, int>> scp(n);
  read(scp);
  vector dp(1 << n, vector<double>(x + 1));
  for (int i{}; i <= x; ++i) {
    for (int m{}; m < (1 << n); ++m) {
      for (int j{}; j < n; ++j) {
        const auto& [s, c, p]{scp[j]};
        if (i >= c && (m >> j) & 1) {
          const auto ev{p * (s + dp[m ^ (1 << j)][i - c]) +
                        (100 - p) * dp[m][i - c]};
          dp[m][i] = max(dp[m][i], ev / 100);
        }
      }
    }
  }
  write(dp.back()[x]);
}

int main() {
  cin.tie(0)->sync_with_stdio(0);
  cout << fixed << setprecision(10);
  solve();
}

Submission Info

Submission Time
Task E - Payment Required
User nika_skybytska
Language C++ 20 (gcc 12.2)
Score 450
Code Size 5164 Byte
Status AC
Exec Time 28 ms
Memory 13220 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 4
AC × 43
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt, 02_random_30.txt, 02_random_31.txt, 02_random_32.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3736 KiB
00_sample_01.txt AC 1 ms 3896 KiB
00_sample_02.txt AC 1 ms 3804 KiB
00_sample_03.txt AC 1 ms 3872 KiB
01_handmade_00.txt AC 1 ms 3772 KiB
01_handmade_01.txt AC 1 ms 3768 KiB
01_handmade_02.txt AC 1 ms 3856 KiB
01_handmade_03.txt AC 1 ms 3804 KiB
01_handmade_04.txt AC 28 ms 13096 KiB
01_handmade_05.txt AC 27 ms 13052 KiB
02_random_00.txt AC 1 ms 3896 KiB
02_random_01.txt AC 1 ms 3904 KiB
02_random_02.txt AC 2 ms 4028 KiB
02_random_03.txt AC 1 ms 3868 KiB
02_random_04.txt AC 1 ms 3988 KiB
02_random_05.txt AC 2 ms 3996 KiB
02_random_06.txt AC 1 ms 3772 KiB
02_random_07.txt AC 1 ms 3932 KiB
02_random_08.txt AC 3 ms 4100 KiB
02_random_09.txt AC 1 ms 3940 KiB
02_random_10.txt AC 11 ms 12972 KiB
02_random_11.txt AC 1 ms 3956 KiB
02_random_12.txt AC 27 ms 13032 KiB
02_random_13.txt AC 1 ms 3956 KiB
02_random_14.txt AC 21 ms 13212 KiB
02_random_15.txt AC 1 ms 3828 KiB
02_random_16.txt AC 19 ms 13040 KiB
02_random_17.txt AC 1 ms 3900 KiB
02_random_18.txt AC 11 ms 13220 KiB
02_random_19.txt AC 1 ms 3768 KiB
02_random_20.txt AC 27 ms 13052 KiB
02_random_21.txt AC 1 ms 3940 KiB
02_random_22.txt AC 21 ms 13096 KiB
02_random_23.txt AC 1 ms 4060 KiB
02_random_24.txt AC 27 ms 13084 KiB
02_random_25.txt AC 1 ms 3960 KiB
02_random_26.txt AC 28 ms 13068 KiB
02_random_27.txt AC 1 ms 3924 KiB
02_random_28.txt AC 27 ms 13088 KiB
02_random_29.txt AC 1 ms 3840 KiB
02_random_30.txt AC 28 ms 12972 KiB
02_random_31.txt AC 1 ms 3960 KiB
02_random_32.txt AC 28 ms 13140 KiB