제출 #866163

#제출 시각아이디문제언어결과실행 시간메모리
866163lomtaDNA 돌연변이 (IOI21_dna)C++17
0 / 100
28 ms4468 KiB
#include "dna.h" #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int pref1[N],pref2[N],pref3[N]; void init(std::string a, std::string b) { pref1[0]=0; for(int i=0;i<a.size();i++){ pref1[i+1]=pref1[i]; if(a[i]=='A' && b[i]=='T'){ pref1[i+1]++; } if(a[i]=='T' && b[i]=='A'){ pref1[i+1]--; } } pref2[0]=0; for(int i=0;i<a.size();i++){ pref2[i+1]=pref2[i]; if(a[i]=='T' && b[i]=='C'){ pref2[i+1]++; } if(a[i]=='C' && b[i]=='T'){ pref2[i+1]--; } } pref3[0]=0; for(int i=0;i<a.size();i++){ pref3[i+1]=pref3[i]; if(a[i]=='C' && b[i]=='A'){ pref3[i+1]++; } if(a[i]=='A' && b[i]=='C'){ pref3[i+1]--; } } } int get_distance(int x, int y) { x++; y++; x--; int a1=pref1[y]-pref1[x]; int b1=pref2[y]-pref2[x]; int c1=pref3[y]-pref3[x]; if(a1!=b1 || b1!=c1 || c1!=a1){ return -1; } int sz=y-x; return (sz-abs(a1)-abs(b1)-abs(c1))/2+(abs(a1)+abs(b1)+abs(c1))/3*2; }

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

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