結果

問題 No.832 麻雀修行中
ユーザー risujirohrisujiroh
提出日時 2019-05-24 21:39:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 1,417 bytes
コンパイル時間 2,156 ms
コンパイル使用メモリ 187,128 KB
実行使用メモリ 36,504 KB
最終ジャッジ日時 2023-10-17 12:21:52
合計ジャッジ時間 11,770 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 269 ms
36,504 KB
testcase_01 AC 268 ms
36,504 KB
testcase_02 AC 268 ms
36,504 KB
testcase_03 AC 268 ms
36,504 KB
testcase_04 AC 269 ms
36,504 KB
testcase_05 AC 269 ms
36,504 KB
testcase_06 AC 269 ms
36,504 KB
testcase_07 AC 270 ms
36,504 KB
testcase_08 AC 270 ms
36,504 KB
testcase_09 AC 269 ms
36,504 KB
testcase_10 AC 269 ms
36,504 KB
testcase_11 AC 268 ms
36,504 KB
testcase_12 AC 268 ms
36,504 KB
testcase_13 AC 269 ms
36,504 KB
testcase_14 AC 269 ms
36,504 KB
testcase_15 AC 268 ms
36,504 KB
testcase_16 AC 269 ms
36,504 KB
testcase_17 AC 268 ms
36,504 KB
testcase_18 AC 267 ms
36,504 KB
testcase_19 AC 267 ms
36,504 KB
testcase_20 AC 267 ms
36,504 KB
testcase_21 AC 267 ms
36,504 KB
testcase_22 AC 268 ms
36,504 KB
testcase_23 AC 269 ms
36,504 KB
testcase_24 AC 269 ms
36,504 KB
testcase_25 AC 269 ms
36,504 KB
testcase_26 AC 270 ms
36,504 KB
testcase_27 AC 269 ms
36,504 KB
testcase_28 AC 268 ms
36,504 KB
testcase_29 AC 269 ms
36,504 KB
testcase_30 AC 269 ms
36,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  V<string> t;
  for (int i = 0; i < 9; ++i) {
    t.push_back(string(3, '1' + i));
    if (i < 7) {
      string x;
      x += '1' + i;
      x += '1' + i + 1;
      x += '1' + i + 2;
      t.push_back(x);
    }
  }
  V<string> s;
  for (int i = 0; i < 1 << 16; ++i) {
    for (int j = 0; j < 9; ++j) {
      string x(2, '1' + j);
      x += t[i & 15];
      x += t[i >> 4 & 15];
      x += t[i >> 8 & 15];
      x += t[i >> 12 & 15];
      sort(begin(x), end(x));
      s.push_back(x);
    }
  }
  V<> p{0, 0, 1, 1, 1, 1, 1, 1, 1};
  do {
    string x;
    for (int i = 0; i < 9; ++i) if (p[i]) {
      x += string(2, '1' + i);
    }
    sort(begin(x), end(x));
    s.push_back(x);
  } while (next_permutation(begin(p), end(p)));
  for (auto&& e : s) {
    bool ok = true;
    for (int i = 0; i < 9; ++i) if (count(begin(e), end(e), '1' + i) > 4) {
      ok = false;
      break;
    }
    if (!ok) e = "";
  }
  sort(begin(s), end(s));
  s.erase(unique(begin(s), end(s)), end(s));
  string str; cin >> str;
  for (int i = 0; i < 9; ++i) {
    auto x = str;
    x += '1' + i;
    sort(begin(x), end(x));
    if (!binary_search(begin(s), end(s), x)) continue;
    cout << i + 1 << '\n';
  }
}
0