結果
問題 | No.286 Modulo Discount Store |
ユーザー | alpha_virginis |
提出日時 | 2015-10-09 22:36:04 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,113 bytes |
コンパイル時間 | 1,253 ms |
コンパイル使用メモリ | 149,948 KB |
実行使用メモリ | 8,760 KB |
最終ジャッジ日時 | 2023-09-27 10:03:55 |
合計ジャッジ時間 | 4,798 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 3 ms
4,376 KB |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
ソースコード
#include <bits/stdc++.h> #include <cstdint> #include <sys/time.h> typedef std::int_fast32_t s32; typedef std::uint_fast32_t u32; typedef std::int_fast64_t s64; typedef std::uint_fast64_t u64; const unsigned long mod = 1000000007; const double EPS = 0.00000001; const int INF = (1 << 29); typedef std::pair<int, int> pii; template<typename T> void print_array(T *A_, s32 size) { //printf("%d\n", size); if( size != 0 ) { for(int i = 0; i < size - 1; ++i) { printf("%d ", A_[i]); } printf("%d\n", A_[size - 1]); } } auto solve(int n, std::vector<int> &m) -> int { int mod = 0; int res = 0; for(int i = 0; i < n; ++i) { res += std::max(0, m[i] - mod); mod += m[i]; mod %= 1000; } return res; } auto main() -> int { int n; std::vector<int> m; std::cin >> n; for(int i = 0; i < n; ++i) { int temp; std::cin >> temp; m.push_back(temp); } std::sort(m.begin(), m.end()); int res = INF; do { res = std::min(res, solve(n, m)); } while( next_permutation(m.begin(), m.end()) ); std::cout << res << std::endl; return 0; }