# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
953056 |
2024-03-25T11:34:04 Z |
KasymK |
Mutating DNA (IOI21_dna) |
C++17 |
|
29 ms |
2632 KB |
#include "dna.h"
#include "bits/stdc++.h"
using namespace std;
string s, s2;
int n;
const int N = 1e5 + 5;
int p_a[N] = {0}, p_b[N] = {0}, p_bile[N] = {0};
// hemmesinin icini basda nollayas
void init(string a, string b) {
s = a;
s2 = b;
for(int i = 0; i < n; ++i){
p_a[i + 1] = p_a[i];
p_b[i + 1] = p_b[i];
p_bile[i + 1] = p_bile[i];
if(a[i] == 'A')
p_a[i + 1]++;
if(b[i] == 'A')
p_b[i + 1]++;
if(a[i] == b[i])
p_bile[i + 1]++;
}
}
int get_distance(int x, int y){
int uz_a = p_a[y + 1] - p_a[x], uz_b = p_b[y + 1] - p_b[x];
int uz_bile = p_bile[y + 1] - p_bile[x];
if(uz_a != uz_b)
return -1;
else{
int ret = (y - x + 1 - uz_bile) >> 1;
return ret;
}
}
// int main(){
// cin >> n;
// string a, b;
// cin >> a >> b;
// init(a, b);
// int q;
// cin >> q;
// while(q--){
// int x, y;
// cin >> x >> y;
// int ans = get_distance(x, y);
// cout << ans << "\n";
// }
// return 0;
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2632 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |