結果
問題 | No.2708 Jewel holder |
ユーザー |
![]() |
提出日時 | 2024-03-31 20:11:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,043 bytes |
コンパイル時間 | 2,366 ms |
コンパイル使用メモリ | 197,892 KB |
最終ジャッジ日時 | 2025-02-20 18:18:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 9 |
ソースコード
#include <bits/stdc++.h>#ifdef LOCAL#include "./debug.cpp"#else#define debug(...)#define print_line#endifusing namespace std;using ll = long long;int main() {int H, W;cin >> H >> W;vector<string> S(H);for (int i = 0; i < H; i++) {cin >> S[i];}vector<int> T(H + W - 2, 0);for (int i = H - 1; i < H + W - 2; i++) {T[i] = 1;}int ans = 0;do {int cnt = 0, x = 0, y = 0;bool ok = true;for (int i = 0; i < H + W - 2; i++) {if (x >= H || y >= H || S[x][y] == '#') {ok = false;break;}if (S[x][y] == 'o') {cnt++;} else if (S[x][y] == 'x' && cnt > 0) {cnt--;}if (T[i] == 0) {x++;} else {y++;}}if (ok && cnt > 0) {ans++;}} while (next_permutation(T.begin(), T.end()));cout << ans << endl;}