제출 #738569

#제출 시각아이디문제언어결과실행 시간메모리
738569ToxtaqDNA 돌연변이 (IOI21_dna)C++17
0 / 100
68 ms2500 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; if(s[0] == s[1])continue; 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...