Submission #738567

#TimeUsernameProblemLanguageResultExecution timeMemory
738567ToxtaqMutating DNA (IOI21_dna)C++17
0 / 100
73 ms3716 KiB
#include<bits/stdc++.h> using namespace std; string a, b; void init(string s1, string s2){ a = s1; b = s2; } int get_distance(int x, int y){ map<string, int>mp; int res = 0, cnt = 0; for(int i = x;i <= y;++i){ string tempo = ""; tempo += a[i]; tempo += b[i]; mp[tempo]++; } for(auto itr = mp.begin();itr != mp.end();++itr){ string s = itr->first; string d = s; reverse(d.begin(), d.end()); if(mp.count(d)){ res += min(mp[d], mp[s]); mp[s] -= min(mp[d], mp[s]); mp[d] -= min(mp[d], mp[s]); } cnt += mp[s]; } return cnt - 1 + res; } //int main() //{ // string a, b; // cin >> a >> b; // init(a, b); // int q; // cin >> q; // while(q--){ // int l, r; // cin >> l >> r; // cout << get_distance(l, r) << '\n'; // } //}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...