結果
問題 |
No.2708 Jewel holder
|
ユーザー |
|
提出日時 | 2024-07-04 16:00:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,053 bytes |
コンパイル時間 | 5,478 ms |
コンパイル使用メモリ | 308,884 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 16:00:32 |
合計ジャッジ時間 | 6,490 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #ifdef LOCAL #include <algo/debug.h> #else #define debug(...) void(0) #endif #include<atcoder/all> using namespace atcoder; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int H, W; cin >> H >> W; vector<string> A(H); for(int i = 0; i < H; i++) cin >> A[i]; int ans = 0; for(int bit = 0; bit < (1 << H + W - 2); bit++) { if(__builtin_popcount(bit) != H - 1) continue; int now = 1, ii = 0, jj = 0; bool f = 1; for(int i = 0; i < H + W - 2; i++) { if(bit & (1 << i)) ii++; else jj++; if(A[ii][jj] == 'o') { now++; }else if(A[ii][jj] == '#') { f = 0; break; }else { if(now == 0) { f = 0; break; }else { now--; } } } ans += f; } cout << ans << endl; }