# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041621 | vjudge1 | Ljetopica (COI19_ljetopica) | C++17 | 1 ms | 348 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<bits/stdc++.h>
using namespace std;
const int mod = 1'000'000'007;
int N, K;
string s, a, b;
bool small(string a, string b)
{
for(int i = 0; i < a.size(); i++)
if(a[i] != b[i])
return a[i] < b[i];
return false;
}
int val(string s)
{
int hsh = 0;
for(char i : s)
hsh = (hsh * 2ll + (i - '0')) % mod;
return hsh;
}
void subtask1()
{
string ans1 = "1", ans2 = "1";
for(char i : s)
{
if(i == 'L')
ans1 += '0', ans2 += '1';
else
ans1 += '1', ans2 += '0';
}
int ans = 0;
if(!small(ans1, a) && !small(b, ans1))
ans = (ans + val(ans1)) % mod;
if(!small(ans2, a) && !small(b, ans2))
ans = (ans + val(ans2)) % mod;
cout << ans << endl;
exit(0);
}
void subtask2()
{
}
int main()
{
cin >> N >> K >> s >> a >> b;
if(K == 0)
subtask1();
subtask2();
return 0;
}
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... |