Submission #1041472

# Submission time Handle Problem Language Result Execution time Memory
1041472 2024-08-02T04:33:09 Z vjudge1 Ljetopica (COI19_ljetopica) C++17
8 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1e3 + 10, mod = 1e9 + 7, inv2 = 5e8 + 4;
int n, k, ans, pw;
string s, a, b;

int main(){
    cin >> n >> k >> s >> a >> b;
    
    pw = 1;
    for (int i = a.size() - 1; i >= 0; i --){
        ans += (a[i] - '0') * pw;
        ans %= mod;

        pw *= 2;
        pw %= mod;
    }

    pw = 1;
    for (int i = b.size() - 1; i >= 0; i --){
        ans += (b[i] - '0') * pw;
        ans %= mod;

        pw *= 2;
        pw %= mod;
    }

    if (a == b){
        ans = 1ll * ans * inv2 % mod;
        cout << ans << endl;
        return 0;
    }

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 348 KB Output isn't correct
10 Halted 0 ms 0 KB -