Submission #952319

# Submission time Handle Problem Language Result Execution time Memory
952319 2024-03-23T14:20:58 Z wood Mutating DNA (IOI21_dna) C++17
0 / 100
27 ms 3792 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007

vector<int> pref_b;
vector<int> pref_a;

vector<int> matchpref;
void init(string a, string b) {
    int n = a.size();
    pref_a.resize(n+1);
    pref_b.resize(n+1);
    matchpref.resize(n+1);
    for (size_t i = 0; i < a.size(); i++) {
        pref_a[i + 1] = pref_a[i] + (a[i] == 'A');
        pref_b[i + 1] = pref_b[i] + (b[i] == 'A');
        matchpref[i + 1] = matchpref[i]+(a[i] == 'A') && (b[i] == 'A');
    }
}

int get_distance(int x, int y) {
    if (pref_a[y + 1] - pref_a[x] - pref_b[y + 1] - pref_b[x]) {
        return -1;
    }
    else return (pref_a[y + 1] - pref_a[x] - matchpref[y + 1] + matchpref[x]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3792 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 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 2 ms 2140 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 2 ms 2140 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 2 ms 2140 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3792 KB Output isn't correct
2 Halted 0 ms 0 KB -