제출 #614271

#제출 시각아이디문제언어결과실행 시간메모리
614271John3_141592DNA 돌연변이 (IOI21_dna)C++17
100 / 100
42 ms8592 KiB
#include <bits/stdc++.h> using namespace std; int A1[100006],C1[100006],T1[100006],A2[100006],C2[100006],T2[100006],AC[100006],AT[100006],CA[100006],CT[100006],TA[100006],TC[100006]; 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],AC[i+1]=AC[i],AT[i+1]=AT[i],CA[i+1]=CA[i],CT[i+1]=CT[i],TA[i+1]=TA[i],TC[i+1]=TC[i]; if(a[i]=='A') A1[i+1]++; if(a[i]=='C') C1[i+1]++; if(a[i]=='T') T1[i+1]++; if(b[i]=='A') A2[i+1]++; if(b[i]=='C') C2[i+1]++; if(b[i]=='T') T2[i+1]++; if(a[i]=='A' && b[i]=='C') AC[i+1]++; if(a[i]=='A' && b[i]=='T') AT[i+1]++; if(a[i]=='C' && b[i]=='A') CA[i+1]++; if(a[i]=='C' && b[i]=='T') CT[i+1]++; if(a[i]=='T' && b[i]=='A') TA[i+1]++; if(a[i]=='T' && b[i]=='C') TC[i+1]++; } } int get_distance(int x,int y){ x++,y++; if(A1[y]-A1[x-1]!=A2[y]-A2[x-1] || C1[y]-C1[x-1]!=C2[y]-C2[x-1] || T1[y]-T1[x-1]!=T2[y]-T2[x-1]) return -1; int solve=0,a=AC[y]-AC[x-1],b=CA[y]-CA[x-1],c=AT[y]-AT[x-1],d=TA[y]-TA[x-1],e=CT[y]-CT[x-1],f=TC[y]-TC[x-1]; if(a>b) swap(a,b); if(c>d) swap(c,d); if(e>f) swap(e,f); solve+=a+c+e+2*(b-a); return solve; }

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

dna.cpp: In function 'void init(std::string, std::string)':
dna.cpp:8:18: 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...