Submission #783983

#TimeUsernameProblemLanguageResultExecution timeMemory
783983MatblubeMutating DNA (IOI21_dna)C++17
43 / 100
1577 ms3768 KiB
#include "dna.h" #include <iostream> #include <iomanip> #include <string> #include <math.h> #include <algorithm> #include <cstring> #include <numeric> #include <vector> #include <map> #include <set> #include <deque> #include <unordered_map> #include <unordered_set> using namespace std; typedef long long ll; #define dbg(x) cerr<<#x<<": "<<x<<"\n"; #define fr(i, x) for(ll i=0 ; i<x ; i++) #define fra(x, v) for(auto x:v) #define fra1(x,v) for(auto &x:v) #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define pb(x) push_back(x) #define F first #define S second string n, m; void init(std::string a, std::string b) { n=a; m=b; } int get_distance(int x, int y) { // xdpro if(n.size()!=m.size()) return -1; map<char, ll>uwu1, uwu2; for(ll i=x ; i<=y ; i++){ uwu1[n[i]]++; uwu2[m[i]]++; } fra(pro, uwu1){ if(pro.second!=uwu2[pro.first]){ return -1; } } fra(pro, uwu2){ if(pro.second!=uwu1[pro.first]){ return -1; } } ll cc=0; for(ll i=x ; i<=y ; i++){ if(n[i]!=m[i]) cc++; } return (cc+1)/2; }
#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...