제출 #580265

#제출 시각아이디문제언어결과실행 시간메모리
580265rc_catuntaDNA 돌연변이 (IOI21_dna)C++17
0 / 100
29 ms2380 KiB
#include "dna.h" #include <algorithm> using namespace std; string sa, sb; void init(string a, string b) { sa = a; sb = b; } bool posible_transformar(string a, string b){ string ca=a,cb=b; sort(ca.begin(),ca.end()); sort(cb.begin(),cb.end()); return ca==cb; } int get_distance(int x, int y) { if(x==y) return 0; string a = sa.substr(x,y-x+1); string b = sb.substr(x,y-x+1); if(a==b) return 0; if(posible_transformar(a,b)){ if(y-x==1) return 1; // Contar letras igual int cont = 0; for(int i=0;i<a.size();i++){ if(a[i]==b[i]) cont++; } if(cont==1) return 1; else return 2; } else return -1; }

컴파일 시 표준 에러 (stderr) 메시지

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