제출 #494151

#제출 시각아이디문제언어결과실행 시간메모리
494151TsiannisDNA 돌연변이 (IOI21_dna)C++17
56 / 100
46 ms9304 KiB
#include "dna.h" using namespace std; typedef long long ll; #define maxn 100005 ll a1[maxn],c1[maxn],t1[maxn],a2[maxn],c2[maxn],t2[maxn],diff[maxn]; void init(string a,string b) { for (int i=0;i<a.size();i++) { a1[i+1]=a1[i]; c1[i+1]=c1[i]; t1[i+1]=t1[i]; a2[i+1]=a2[i]; c2[i+1]=c2[i]; t2[i+1]=t2[i]; diff[i+1]=diff[i]; if (a[i]=='A') a1[i+1]=a1[i]+1; else if (a[i]=='C') c1[i+1]=c1[i]+1; else t1[i+1]=t1[i]+1; if (b[i]=='A') a2[i+1]=a2[i]+1; else if (b[i]=='C') c2[i+1]=c2[i]+1; else t2[i+1]=t2[i]+1; if (a[i]!=b[i]) {diff[i+1]=diff[i]+1;} } } int get_distance(int x,int y) { int pla1=a1[y+1]-a1[x]; int plc1=c1[y+1]-c1[x]; int plt1=t1[y+1]-t1[x]; int pla2=a2[y+1]-a2[x]; int plc2=c2[y+1]-c2[x]; int plt2=t2[y+1]-t2[x]; int d=diff[y+1]-diff[x]; if (pla1!=pla2||plc1!=plc2||plt1!=plt2) return -1; else return (d/2+d%2); }

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

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