Submission #482624

#TimeUsernameProblemLanguageResultExecution timeMemory
482624rc_catuntaMutating DNA (IOI21_dna)C++17
21 / 100
37 ms3864 KiB
#include "dna.h" #include <iostream> #include <algorithm> using namespace std; string sa,sb; void init(string a, string b) { sa=a; sb=b; } int get_distance(int x, int y) { if(y-x<=2){ string a=sa.substr(x,y-x+1); string b=sb.substr(x,y-x+1); if(a==b) return 0; string ca = a; string cb = b; sort(ca.begin(),ca.end()); sort(cb.begin(),cb.end()); if(ca != cb) return -1; int cm = 0; for(int i=0;i<a.size();i++){ if(a[i]==b[i]) cm++; } if(a.size()==3) return 2-cm; if(a.size()==2) return 1-cm; } return 0; }

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:25:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   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...