Submission #00002
ソースコード
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 28 | #include <bits/stdc++.h> using namespace std; typedef long long int64; const int64 INF = 1LL << 58; int N; string S, tmp = "JOI" ; int dp[1000][1 << 3]; int rec( int idx, int kagi) { if (idx == S.size()) return (1); if (~dp[idx][kagi]) return (dp[idx][kagi]); int ret = 0; for ( int i = 0; i < 1 << 3; i++) { if (kagi & i && (i >> tmp.find(S[idx])) & 1) { ret += rec(idx + 1, i); } } return (dp[idx][kagi] = ret % 10007); } int main() { cin >> N; cin >> S; fill_n(*dp, 1000 * (1 << 3), -1); cout << rec(0, 1) << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0005 - 部活のスケジュール表 (Schedule) |
ユーザー名 | ei1333 |
投稿日時 | 2015-11-13 16:20:57 |
言語 | C++11 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 574 Byte |
最大実行時間 | 19 ms |
最大メモリ使用量 | 672 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | 入力1 | 20 / 20 | *1.txt |
2 | 入力2 | 20 / 20 | *[12].txt |
3 | 入力3 | 20 / 20 | *[1-3].txt |
4 | 入力4 | 20 / 20 | *[1-4].txt |
5 | 入力5 | 20 / 20 | *[1-5].txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2014-yo-t4-in1.txt | AC | 19 ms | 476 KB |
1
|
2
|
3
|
4
|
5
|
2014-yo-t4-in2.txt | AC | 14 ms | 428 KB |
2
|
3
|
4
|
5
|
|
2014-yo-t4-in3.txt | AC | 11 ms | 500 KB |
3
|
4
|
5
|
||
2014-yo-t4-in4.txt | AC | 12 ms | 540 KB |
4
|
5
|
|||
2014-yo-t4-in5.txt | AC | 14 ms | 672 KB |
5
|