結果
問題 | No.832 麻雀修行中 |
ユーザー |
![]() |
提出日時 | 2023-11-24 02:14:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 988 bytes |
コンパイル時間 | 2,088 ms |
コンパイル使用メモリ | 194,240 KB |
最終ジャッジ日時 | 2025-02-17 23:33:22 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 25 |
ソースコード
#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]--;}}