結果

問題 No.832 麻雀修行中
ユーザー shobonvipshobonvip
提出日時 2023-11-24 02:14:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 988 bytes
コンパイル時間 2,192 ms
コンパイル使用メモリ 203,692 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-24 02:14:34
合計ジャッジ時間 4,043 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
	vector<int> org(9);
	for (int i=0; i<13; i++){
		char x; cin >> x;
		org[x-'1']++;
	}

	auto inner_hantei_1 = [&]() -> bool {
		vector<int> cop = org;
		for (int d=0; d<9; d++){
			if (cop[d] < 0) return false;
			cop[d] %= 3;
			if (cop[d] > 0 && d >= 8){
				return false;
			}
			cop[d+1] -= cop[d];
			cop[d+2] -= cop[d];
			cop[d] = 0;
		}
		return true;
	};

	auto hantei_1 = [&]() -> bool {
		bool mode = 0;
		for (int d=0; d<9; d++){
			if (org[d] >= 2){
				org[d] -= 2;
				if (inner_hantei_1()) mode = 1;
				org[d] += 2;
				if (mode) break;
			}
		}
		return mode;
	};

	auto hantei_2 = [&]() -> bool {
		int cnt = 0;
		for (int i=0; i<9; i++){
			if (org[i] == 2){
				cnt++;
			}
		}
		return cnt == 7;
	};

	auto hantei = [&]() -> bool {
		return hantei_1() || hantei_2();
	};

	for (int st=0; st<9; st++){
		if (org[st] == 4) continue;
		org[st]++;
		if (hantei()){
			cout << st+1 << '\n';
		}
		org[st]--;
	}
}
0