Submission #867474

#TimeUsernameProblemLanguageResultExecution timeMemory
867474thegamercoder19Mutating DNA (IOI21_dna)C++17
0 / 100
18 ms7628 KiB
#include "dna.h" #include<bits/stdc++.h> using namespace std; vector<vector<int>> prefix; void init(std::string a, std::string b) { prefix.resize(3, vector<int>(a.size()+1)); for(int i=0; i<a.size(); i++) { for(int j=0; j<3; j++) { prefix[j][i+1] = prefix[j][i]; } prefix[a[i]-'A'][i+1]++; prefix[b[i]-'A'][i+1]--; } } int get_distance(int x, int y) { int dist = 0; for(int i=0; i<3; i++) { dist += abs(prefix[i][y+1] - prefix[i][x]); } return dist/2; }

Compilation message (stderr)

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |    for(int i=0; i<a.size(); i++) {
      |                 ~^~~~~~~~~
#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...