結果

問題 No.1783 Remix Sum
ユーザー NyaanNyaanNyaanNyaan
提出日時 2021-10-22 23:39:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,080 bytes
コンパイル時間 1,100 ms
コンパイル使用メモリ 91,964 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-26 04:39:51
合計ジャッジ時間 7,511 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 10 ms
4,376 KB
testcase_05 AC 10 ms
4,376 KB
testcase_06 AC 42 ms
4,376 KB
testcase_07 AC 11 ms
4,380 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 11 ms
4,380 KB
testcase_10 AC 11 ms
4,376 KB
testcase_11 AC 10 ms
4,376 KB
testcase_12 AC 10 ms
4,380 KB
testcase_13 AC 11 ms
4,376 KB
testcase_14 AC 10 ms
4,380 KB
testcase_15 AC 10 ms
4,376 KB
testcase_16 AC 10 ms
4,380 KB
testcase_17 AC 11 ms
4,380 KB
testcase_18 AC 10 ms
4,376 KB
testcase_19 AC 11 ms
4,380 KB
testcase_20 AC 10 ms
4,380 KB
testcase_21 AC 11 ms
4,376 KB
testcase_22 AC 25 ms
4,376 KB
testcase_23 AC 10 ms
4,380 KB
testcase_24 AC 10 ms
4,380 KB
testcase_25 AC 955 ms
4,376 KB
testcase_26 AC 12 ms
4,376 KB
testcase_27 AC 579 ms
4,380 KB
testcase_28 AC 11 ms
4,376 KB
testcase_29 AC 11 ms
4,380 KB
testcase_30 AC 10 ms
4,376 KB
testcase_31 AC 16 ms
4,376 KB
testcase_32 AC 16 ms
4,380 KB
testcase_33 AC 11 ms
4,380 KB
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 RE -
testcase_58 RE -
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

long long ten[] = {1, 10, 100, 1000, 10000, 100000, 1000000};
long long TEN(int n) { return ten[n]; }

int main() {
  long long n, k, m, t;
  cin >> n >> k >> m >> t;
  // assert(10 <= m and m <= 15);
  vector<int> a(n);
  for (auto& x : a) {
    cin >> x;
    // assert(0 <= x and x < TEN(k));
  }
  if (log(n) * m > 20) exit(1);

  auto sm = [&](int i, int j) {
    int res = 0;
    for (int d = 0; d < k; d++) {
      if (d < t) {
        if (i % 10 + j % 10 >= 10) return -1;
        res += (i + j) % 10 * TEN(d);
      } else {
        res += (i + j) % 10 * TEN(d);
      }
      i /= 10, j /= 10;
    }
    return res;
  };

  vector<long long> ans(TEN(k));
  auto dfs = [&](auto rc, int depth, int s) -> void {
    // cerr<<depth<<" "<<s<<endl;
    if (s == -1) return;
    if (depth == m) {
      ans[s]++;
      return;
    }
    for (int i = 0; i < n; i++) rc(rc, depth + 1, sm(s, a[i]));
  };
  dfs(dfs, 0, 0);

  for (int i = 0; i < TEN(k); i++) cout << ans[i] << "\n";
}
0