Submission #00217


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<bits/stdc++.h>
using namespace std;
string t,b;
int dfs(int cnt,string now);
map<string,int>memo[1001];
int main(){
cin>>t;
cin>>b;
cout<<dfs(0,"")<<endl;
return(0);
}
int dfs(int cnt,string now){
string a;
int rec=0;
if(memo[cnt].count(now)!=0)return memo[cnt][now];
if(now==b)return 1;
if(cnt>=t.size()||(int)b.find(now)!=0){
return 0;
}
a=now;
a+=t[cnt];
rec+=dfs(cnt+1,a);
rec+=dfs(cnt+1,now);
return memo[cnt][now]=rec%1000000007;
}

ステータス

項目 データ
問題 0007 - イワシロ・イッツァ
ユーザー名 neko
投稿日時 2017-09-06 18:48:17
言語 C++11
状態 Time Limit Exceeded
得点 0
ソースコード長 511 Byte
最大実行時間 1000 ms
最大メモリ使用量 176612 KB

セット

セット 得点 Cases
1 ALL 0 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 17 ms 480 KB
1
in02.txt AC 15 ms 536 KB
1
in03.txt AC 21 ms 580 KB
1
in04.txt AC 20 ms 1020 KB
1
in05.txt AC 25 ms 964 KB
1
in06.txt AC 21 ms 988 KB
1
in07.txt AC 16 ms 548 KB
1
in08.txt AC 22 ms 604 KB
1
in09.txt AC 16 ms 656 KB
1
in10.txt AC 19 ms 588 KB
1
in11.txt AC 404 ms 70536 KB
1
in12.txt TLE 1000 ms 171480 KB
1
in13.txt AC 772 ms 119368 KB
1
in14.txt AC 419 ms 70340 KB
1
in15.txt TLE 1000 ms 176612 KB
1
in16.txt AC 21 ms 856 KB
1
in17.txt AC 24 ms 516 KB
1
in18.txt AC 19 ms 824 KB
1
in19.txt AC 20 ms 1000 KB
1
in20.txt AC 21 ms 1272 KB
1
in21.txt AC 16 ms 1764 KB
1
in22.txt AC 21 ms 724 KB
1
in23.txt AC 21 ms 2132 KB
1