Submission #739203

#TimeUsernameProblemLanguageResultExecution timeMemory
739203bobthebuilderMutating DNA (IOI21_dna)C++17
43 / 100
1577 ms3764 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define REP(i,n) for(int i=0;i<n;i++) #define REP1(i,n) for(int i=1;i<=n;i++) #define pb push_back #define lowb(x) (x&(-x)) #define ALL(_x) _x.begin(),_x.end() #define pii pair<int,int> #define f first #define s second #define SORT_UNIQUE(x) sort(ALL(x)),x.erase(unique(ALL(x)),x.end()) #define ll long long #define MNTO(x,y) x=min(x,y) #define MXTO(x,y) x=max(x,y) const int maxn=2e5+5; const int INF=0x3f3f3f3f; string a,b; #define REP(i,n) for(int i=0;i<n;i++) int to(char c){ if(c=='A') return 0; if(c=='T') return 1; return 2; } void init(std::string A, std::string B) { a=A,b=B; } int get_distance(int x, int y) { int cnt=0; int c[3]={0,0,0}; for(int i=x;i<=y;i++){ c[to(a[i])]++; c[to(b[i])]--; if(a[i]!=b[i]){ ++cnt; } } REP(i,3){ if(c[i]){ return -1; } } return (cnt+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...