Submission #1025313

#TimeUsernameProblemLanguageResultExecution timeMemory
1025313cpdreamerMutating DNA (IOI21_dna)C++17
21 / 100
21 ms3920 KiB
#include "dna.h" #include <cstdio> #include <cassert> #include <string> #include <vector> using namespace std; struct ct{ int a; int c; int t; }; bool compare (ct a,ct b){ if(a.a==b.a && a.c==b.c && a.t==b.t) return true; return false; } string s,t; void init(std::string a, std::string b) { s=a; t=b; } int get_distance(int x, int y) { ct state_s={0, 0, 0}; ct state_t={0, 0, 0}; int c=y-x+1; for(int i=x;i<=y;i++){ if(s[i]=='A')state_s.a++; if(s[i]=='C')state_s.c++; if(s[i]=='T')state_s.t++; if(t[i]=='A')state_t.a++; if(t[i]=='C')state_t.c++; if(t[i]=='T')state_t.t++; if(s[i]==t[i] || compare(state_s,state_t))c--; if(i==y && !compare(state_s,state_t)) return -1; } return c; }
#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...