Submission #00127
ソースコード
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 29 30 31 32 33 34 35 36 37 | #include <bits/stdc++.h> #define endl "\n" using namespace std; int main(){ #define int long long int n,m; cin >>n; string s; cin >>s; vector<vector< int >>dp(n+1,vector< int >(8,0)); for ( int i = 0;i < 8;i++){ if (i & 4)dp[0][i] = 1; } for ( int i = 0;i < n;i++){ int x = 4; if (s[i] == 'O' )x = 2; if (s[i] == 'I' )x = 1; for ( int j = 1;j < 8;j++){ if (!(j & x)){ dp[i][j] = 0; } dp[i][j] %= 10007; if (dp[i][j] != 0){ for ( int l = 1;l < 8;l++){ if (j & l){ dp[i+1][l] += dp[i][j]; } } } } } int ans = 0; for ( int j = 1;j < 8;j++){ ans+=dp[n-1][j]%10007; } cout <<ans<<endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - 部活のスケジュール表 (Schedule) |
ユーザー名 | ei2332 |
投稿日時 | 2023-11-14 14:29:38 |
言語 | C++17 |
状態 | Wrong Answer |
得点 | 20 |
ソースコード長 | 909 Byte |
最大実行時間 | 24 ms |
最大メモリ使用量 | 588 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | 入力1 | 20 / 20 | *1.txt |
2 | 入力2 | 0 / 20 | *[12].txt |
3 | 入力3 | 0 / 20 | *[1-3].txt |
4 | 入力4 | 0 / 20 | *[1-4].txt |
5 | 入力5 | 0 / 20 | *[1-5].txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2014-yo-t4-in1.txt | AC | 24 ms | 472 KB |
1
|
2
|
3
|
4
|
5
|
2014-yo-t4-in2.txt | WA | 20 ms | 440 KB |
2
|
3
|
4
|
5
|
|
2014-yo-t4-in3.txt | WA | 17 ms | 408 KB |
3
|
4
|
5
|
||
2014-yo-t4-in4.txt | WA | 21 ms | 588 KB |
4
|
5
|
|||
2014-yo-t4-in5.txt | WA | 21 ms | 584 KB |
5
|