結果
| 問題 |
No.2708 Jewel holder
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 13:36:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 587 bytes |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 65,164 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-30 18:08:43 |
| 合計ジャッジ時間 | 1,342 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int H,W;
string A[10];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>H>>W;
for(int i=0;i<H;i++)cin>>A[i];
int ans=0;
for(int i=0;i<1<<H+W-2;i++)
{
bool ok=true;
int now=1;
int x=0,y=0;
for(int j=0;j<H+W-2;j++)
{
if(i>>j&1)x++;
else y++;
if(x>=H||y>=W||A[x][y]=='#')
{
ok=false;
break;
}
if(A[x][y]=='o')now++;
else
{
assert(A[x][y]=='x');
now--;
}
if(now<0)
{
ok=false;
break;
}
}
if(ok)
{
ans++;
}
}
cout<<ans<<endl;
}