Submission #957276

#TimeUsernameProblemLanguageResultExecution timeMemory
957276DeltaStructLinear Garden (IOI08_linear_garden)C++17
0 / 100
17 ms3680 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int n,m,r=0; cin >> n >> m; string s; cin >> s; vector dp(7,vector<int>(7)); dp[3][3] = 1; auto res = dp; for (int i(n-1);i > -1;--i){ if (s[i]=='P') for (int k(0);k < 7;++k) for (int j(0);j < 7;++j) r += dp[k][j]; for (int k(0);k < 7;++k) for (int j(0);j < 7;++j) res[k][j] = 0; for (int k(0);k < 7;++k) for (int j(k);j < 6;++j) res[min(k+1,1ll)][max(j+1,1ll)] += dp[k][j]; for (int k(1);k < 7;++k) for (int j(k);j < 7;++j) res[min(k-1,-1ll)][max(j-1,-1ll)] += dp[k][j]; } cout << r << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...