Submission #643681

#TimeUsernameProblemLanguageResultExecution timeMemory
643681rociohdzMutating DNA (IOI21_dna)C++17
0 / 100
42 ms3872 KiB
#include "dna.h" #include<bits/stdc++.h> #define pb push_back using namespace std; vector<char>s1, s2; void init(std::string a, std::string b) { for( int i = 0; i < a.size(); i++ ){ s1.pb(a[i]); s2.pb(b[i]); } } int get_distance(int x, int y) { vector<char>v1,v2; int cont=0; for(int i=x;i<=y;i++){ if(s1[i]!=s2[i])cont++; v1.push_back(s1[i]); v2.push_back(s2[i]); } sort(v1.begin(),v1.end()); sort(v2.begin(),v2.end()); for(int i=0;i<v1.size();i++){ if(v1[i] != v2[i]) return -1; } return cont-1; }

Compilation message (stderr)

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