結果
問題 |
No.2708 Jewel holder
|
ユーザー |
![]() |
提出日時 | 2024-03-31 20:12:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,104 bytes |
コンパイル時間 | 2,176 ms |
コンパイル使用メモリ | 197,068 KB |
最終ジャッジ日時 | 2025-02-20 18:18:26 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 6 |
ソースコード
#include <bits/stdc++.h> #ifdef LOCAL #include "./debug.cpp" #else #define debug(...) #define print_line #endif using 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--; } else { ok = false; break; } if (T[i] == 0) { x++; } else { y++; } } if (ok) { ans++; } } while (next_permutation(T.begin(), T.end())); cout << ans << endl; }