結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 WA -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 WA -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
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 <iostream>
#include <vector>
#include <cmath>
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 > 8) 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++)
    if (ans[i] != 0) cout << i << " " << ans[i] << endl;
}
0