Submission #443804

#TimeUsernameProblemLanguageResultExecution timeMemory
443804fuad27Mutating DNA (IOI21_dna)C++17
0 / 100
39 ms4980 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; string a, b; vector<int> prefix; vector<int> prefA; vector<int> prefB; void init(string A, string B) { a = A; b = B; prefix.resize(A.length()+1, 0); prefA.resize(A.length() +1, 0); prefB.resize(A.length() +1, 0); for(int i = 0;i<A.length();i++) { if(A[i] != B[i]) { prefix[i+1] = prefix[i] + 1; } else { prefix[i+1] = prefix[i]; } if(A[i] == A[0]) { prefA[i+1] = prefA[i] + 1; } else { prefA[i+1] - prefA[i] - 1; } if(B[i] == A[0]) { prefB[i+1] = prefB[i] + 1; } else { prefB[i+1] = prefB[i] - 1; } } } int get_distance(int x, int y) { if(prefA[y+1] - prefA[x] != prefB[y+1] - prefB[x]) { return -1; } return (prefix[y+1] - prefix[x])/2; }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:14:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(int i = 0;i<A.length();i++) {
      |                ~^~~~~~~~~~~
dna.cpp:25:26: warning: value computed is not used [-Wunused-value]
   25 |    prefA[i+1] - prefA[i] - 1;
#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...