# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041577 | vjudge1 | Ljetopica (COI19_ljetopica) | C++17 | 1 ms | 620 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
const int N = 1e5 + 10;
int tp[N], mod = 1e9 + 7;
int main(){
tp[0] = 1;
for (int i=1;i<N;i++)
tp[i] = (tp[i-1] + tp[i-1]) % mod;
int n, k;
cin>>n>>k;
string s, l, r, p1 = "1", p2 = "1";
cin>>s>>l>>r;
for (int i=0;i<n-1;i++){
if (s[i] == 'L')
p1 += '0', p2 += '1';
else
p1 += '1', p2 += '0';
}
int Ans = 0;
for (auto i : {p1, p2}){
if (i > r and i < l)
continue;
for (int j=0;j<i.size();j++)
if (i[j] == '1')
Ans = (Ans + tp[i.size() - 1 - j]) % mod;
}
cout<<Ans<<'\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |