結果
問題 | No.1738 What's in the box? |
ユーザー | naskya |
提出日時 | 2021-11-12 22:04:43 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 6,003 bytes |
コンパイル時間 | 1,412 ms |
コンパイル使用メモリ | 151,812 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-05-04 08:50:22 |
合計ジャッジ時間 | 2,882 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,940 KB |
testcase_14 | AC | 2 ms
6,944 KB |
testcase_15 | AC | 1 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,948 KB |
testcase_18 | AC | 1 ms
6,944 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,944 KB |
testcase_23 | AC | 2 ms
6,944 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,944 KB |
testcase_26 | AC | 2 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,944 KB |
testcase_30 | AC | 2 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,940 KB |
testcase_32 | AC | 1 ms
6,940 KB |
testcase_33 | AC | 1 ms
6,944 KB |
testcase_34 | AC | 2 ms
6,940 KB |
testcase_35 | AC | 2 ms
6,940 KB |
testcase_36 | AC | 1 ms
6,940 KB |
testcase_37 | AC | 2 ms
6,940 KB |
testcase_38 | AC | 2 ms
6,940 KB |
testcase_39 | AC | 2 ms
6,940 KB |
testcase_40 | AC | 1 ms
6,944 KB |
testcase_41 | AC | 1 ms
6,940 KB |
testcase_42 | AC | 2 ms
6,944 KB |
testcase_43 | AC | 2 ms
6,944 KB |
testcase_44 | AC | 2 ms
6,940 KB |
testcase_45 | AC | 1 ms
6,944 KB |
testcase_46 | AC | 1 ms
6,944 KB |
testcase_47 | AC | 2 ms
6,944 KB |
testcase_48 | AC | 2 ms
6,944 KB |
testcase_49 | AC | 2 ms
6,940 KB |
testcase_50 | AC | 2 ms
6,944 KB |
testcase_51 | AC | 2 ms
6,940 KB |
testcase_52 | AC | 1 ms
6,940 KB |
testcase_53 | AC | 2 ms
6,940 KB |
testcase_54 | AC | 1 ms
6,944 KB |
testcase_55 | AC | 2 ms
6,944 KB |
testcase_56 | AC | 2 ms
6,940 KB |
testcase_57 | AC | 1 ms
6,940 KB |
testcase_58 | AC | 1 ms
6,940 KB |
testcase_59 | AC | 2 ms
6,940 KB |
testcase_60 | AC | 2 ms
6,940 KB |
testcase_61 | AC | 1 ms
6,944 KB |
testcase_62 | AC | 2 ms
6,944 KB |
testcase_63 | AC | 1 ms
6,944 KB |
testcase_64 | AC | 1 ms
6,944 KB |
testcase_65 | AC | 2 ms
6,940 KB |
testcase_66 | AC | 1 ms
6,944 KB |
testcase_67 | AC | 1 ms
6,940 KB |
testcase_68 | AC | 2 ms
6,944 KB |
testcase_69 | AC | 1 ms
6,944 KB |
testcase_70 | AC | 1 ms
6,944 KB |
testcase_71 | AC | 2 ms
6,944 KB |
testcase_72 | AC | 1 ms
6,940 KB |
ソースコード
#pragma region template // clang-format off #ifdef ONLINE_JUDGE #pragma GCC optimize "fast-math" #endif #ifdef LOCAL_NDEBUG #include <headers.hpp> #endif // #define USE_EXTERNAL_CONTAINERS // #define NO_PRINT_INF #ifdef USE_EXTERNAL_CONTAINERS #define PROPER #include <boost/container/flat_map.hpp> #include <boost/container/flat_set.hpp> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> template <class T> using tree = __gnu_pbds::tree<T, __gnu_pbds::null_type, std::less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>; template <class S, class T> using hash_table = __gnu_pbds::gp_hash_table<S, T>; #endif #ifdef LOCAL_DEBUG #if (defined USE_EXTERNAL_CONTAINERS) || (defined NO_PRINT_INF) #include <../src/debugger.hpp> #else #include <debugger.hpp> #endif #endif #define PROPER #define _USE_MATH_DEFINES #if (defined __INTELLISENSE__) && (!defined PROPER) #define NDEBUG namespace std { #endif #include <cassert> #include <cctype> #include <cmath> #include <cstddef> #include <cstdint> #include <cstdlib> #include <algorithm> #include <array> #include <bitset> #include <charconv> #include <complex> #include <deque> #include <functional> #include <iostream> #include <iomanip> #include <iterator> #include <limits> #include <list> #include <map> #include <numeric> #include <queue> #include <regex> #include <set> #include <sstream> #include <stack> #include <string> #include <string_view> #include <tuple> #include <typeinfo> #include <type_traits> #include <utility> #include <vector> #if (defined __INTELLISENSE__) && (!defined PROPER) using namespace std; } #endif using namespace std::literals; #ifdef LOCAL_DEBUG #define CP_LIBRARY_DEBUG_LEVEL 2 #define STR(x) #x #define STRINGIFY(x) STR(x) #define FILE_LINE "[Debug] ./" __FILE__ ":" STRINGIFY(__LINE__) #define see(...) debugger::multi_print(#__VA_ARGS__, __VA_ARGS__) #define see2(arg) arg.debug_print(#arg) #define here(...) debugger::os << FILE_LINE << " in " << __func__ << ": \033[32mReached\033[39m\n" #define com(msg) debugger::os << FILE_LINE << " in " << __func__ << ":\n \033[36mComment:\033[39m " << msg << "\n" #define err(msg) debugger::os << FILE_LINE << " in " << __func__ << ":\n \033[31mError:\033[39m " << msg << "\n" #define local(...) do { __VA_ARGS__ } while (0) #define alter(x, y) x #define pass (com("ToDo: Fill here"), true) #else #define see(...) (static_cast<void>(0)) #define see2(arg) (static_cast<void>(0)) #define here(...) (static_cast<void>(0)) #define com(msg) (static_cast<void>(0)) #define err(msg) (static_cast<void>(0)) #define local(...) (static_cast<void>(0)) #define alter(x, y) y #ifdef __INTELLISENSE__ #define pass (static_cast<void>(0)) #else #define pass static_assert(false) #endif #endif #if (defined LOCAL_DEBUG) && (!defined NOWARN) #define warn(msg) debugger::os << FILE_LINE << " in " << __func__ << ":\n \033[33mWarning:\033[39m " << msg << "\n" #else #define warn(msg) (static_cast<void>(0)) #endif #if (defined LOCAL_DEBUG) || (defined LOCAL_NDEBUG) || (defined __INTELLISENSE__) #define NOEXCEPT #define M_assert(expr) assert(expr) #define O_assert(expr) assert(expr) #else #define NOEXCEPT noexcept #define M_assert(expr) do {if(__builtin_expect(!(expr), 0)) {auto p = static_cast<std::int64_t*>(std::malloc(1 << 30)); for (int i = 0; i < (1 << 27); p[i] = 1, i += (1 << 9)); std::cerr << (*p);}} while (0) #define O_assert(expr) do {if(__builtin_expect(!(expr), 0)) {const auto X = std::string(1000, '-'); for(int i = 0; i < (1 << 18); i++) std::cout << X;}} while (0) #endif #define CP_LIBRARY_WARN(msg) warn(msg) #define CP_LIBRARY_ASSERT(...) O_assert(__VA_ARGS__) #define as(type, val) static_cast<std::decay_t<type>>(val) #define INDIRECT(...) __VA_ARGS__ #define rep(loop_var, loop_end) \ for ( \ auto loop_var = as(std::make_signed_t<decltype(loop_end)>, 0); \ loop_var < as(decltype(loop_var), loop_end); \ ++loop_var \ ) #define rng(loop_var, loop_start, loop_end, loop_increment) \ for ( \ auto loop_var = as(INDIRECT(std::make_signed_t<std::common_type_t<decltype(loop_start), decltype(loop_end)>>), loop_start); \ ((loop_increment) > 0) ? (loop_var < as(decltype(loop_var), loop_end)) : (loop_var > as(decltype(loop_var), loop_end)); \ loop_var += (loop_increment) \ ) #define erng(loop_var, loop_start, loop_end, loop_increment) \ for ( \ auto loop_var = as(INDIRECT(std::make_signed_t<std::common_type_t<decltype(loop_start), decltype(loop_end)>>), loop_start); \ ((loop_increment) > 0) ? (loop_var <= as(decltype(loop_var), loop_end)) : (loop_var >= as(decltype(loop_var), loop_end)); \ loop_var += (loop_increment) \ ) [[maybe_unused]] constexpr int INF = 1000000005; [[maybe_unused]] constexpr long long LINF = 1000000000000000005LL; [[maybe_unused]] constexpr double EPS = 1e-9; [[maybe_unused]] constexpr long double LEPS = 1e-14L; [[maybe_unused]] constexpr int dy[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0}; [[maybe_unused]] constexpr int dx[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0}; template <class... Ts> [[nodiscard]] constexpr auto Min(const Ts... args) { return std::min({ as(std::common_type_t<Ts...>, args) ... }); } template <class... Ts> [[nodiscard]] constexpr auto Max(const Ts... args) { return std::max({ as(std::common_type_t<Ts...>, args) ... }); } // clang-format on #pragma endregion void solve() { long long N, M; std::cin >> N >> M; std::vector<long long> W(N); std::copy_n(std::istream_iterator<decltype(W)::value_type>(std::cin), std::size(W), std::begin(W)); long long S = std::reduce(std::cbegin(W), std::cend(W), 0LL); if (S == 0) { rep(i, N - 1) { std::cout << "0 "; } std::cout << "0\n"; return; } rep(i, N) { std::cout << ((W[i] * M) / S) << " \n"[i + 1 == N]; } } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); std::cout << std::fixed << std::setprecision(25); solve(); }