結果
| 問題 |
No.832 麻雀修行中
|
| コンテスト | |
| ユーザー |
kwm_t
|
| 提出日時 | 2023-04-23 23:22:57 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 185 ms / 2,000 ms |
| コード長 | 1,967 bytes |
| コンパイル時間 | 2,336 ms |
| コンパイル使用メモリ | 208,288 KB |
| 最終ジャッジ日時 | 2025-02-12 13:41:05 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define P pair<int,int>
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
set<string>st;
rep2(i, 1, 10)rep2(j, i + 1, 10)rep2(k, j + 1, 10)rep2(l, k + 1, 10)rep2(m, l + 1, 10)rep2(n, m + 1, 10)rep2(o, n + 1, 10) {
string str;
rep(_, 2)str += i + '0';
rep(_, 2)str += j + '0';
rep(_, 2)str += k + '0';
rep(_, 2)str += l + '0';
rep(_, 2)str += m + '0';
rep(_, 2)str += n + '0';
rep(_, 2)str += o + '0';
st.insert(str);
}
rep2(i, 1, 10)rep2(j, 1, 10)rep2(k, 1, 10)rep2(l, 1, 10)rep2(m, 1, 10) {
rep(t0, 2)rep(t1, 2)rep(t2, 2)rep(t3, 2) {
vector<int>cnt(12);
string str;
rep(_, 2) {
str += i + '0';
cnt[i]++;
}
auto f = [&](int x, int type)->void {
rep(_, 3) {
str += x + _ * type + '0';
cnt[x + _ * type]++;
}
};
f(j, t0), f(k, t1), f(l, t2), f(m, t3);
bool chk = true;
rep(i, 12) {
if (cnt[i] > 4)chk = false;
if ((i >= 10) && (cnt[i]))chk = false;
}
if (!chk)break;
sort(all(str));
st.insert(str);
}
}
string s; cin >> s;
rep2(i, 1, 10) {
auto cs = s;
cs += i + '0';
sort(all(cs));
if (st.count(cs)) cout << i << endl;
}
return 0;
}
kwm_t