結果
| 問題 | No.2708 Jewel holder |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-25 03:45:03 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 404µs | |
| コード長 | 652 bytes |
| 記録 | |
| コンパイル時間 | 3,279 ms |
| コンパイル使用メモリ | 176,320 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-25 03:45:12 |
| 合計ジャッジ時間 | 4,413 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
ll dp[10][10][102];
int main(void){
int h, w; cin >> h >> w;
vector<string> s(h);
for(auto&x:s) cin >> x;
dp[0][0][1]=1;
for(int i=0; i<h; i++)for(int j=0; j<w; j++){
if(i==0&&j==0) continue;
if(s[i][j]=='#') continue;
for(int d=0; d<=100; d++){
int nd=d+(s[i][j]=='o'?1:-1);
if(nd<0) continue;
if(i&&s[i-1][j]!='#') dp[i][j][nd]+=dp[i-1][j][d];
if(j&&s[i][j-1]!='#') dp[i][j][nd]+=dp[i][j-1][d];
}
}
ll ans=0;
for(int i=0; i<=100; i++) ans+=dp[h-1][w-1][i];
cout << ans << endl;
return 0;
}