제출 #730069

#제출 시각아이디문제언어결과실행 시간메모리
730069lucriDNA 돌연변이 (IOI21_dna)C++17
100 / 100
45 ms23432 KiB
#include "dna.h" #include <cstdio> #include <cassert> #include <string> #include <vector> int nr[100010][50],l; inline int cod(char a) { if(a=='A') return 1; if(a=='T') return 2; if(a=='C') return 3; } void init(std::string a, std::string b) { for(;a[l];++l) { for(int i=0;i<=3;++i) for(int j=0;j<=3;++j) nr[l+1][i*10+j]=nr[l][i*10+j]; ++nr[l+1][cod(a[l])*10]; ++nr[l+1][cod(b[l])]; ++nr[l+1][cod(a[l])*10+cod(b[l])]; } } int get_distance(int x, int y) { ++x; ++y; if(nr[y][10]-nr[x-1][10]!=nr[y][1]-nr[x-1][1]||nr[y][20]-nr[x-1][20]!=nr[y][2]-nr[x-1][2]||nr[y][30]-nr[x-1][30]!=nr[y][3]-nr[x-1][3]) return -1; int a=nr[y][12]-nr[x-1][12]; int b=nr[y][13]-nr[x-1][13]; int c=nr[y][21]-nr[x-1][21]; int d=nr[y][23]-nr[x-1][23]; int e=nr[y][31]-nr[x-1][31]; int f=nr[y][32]-nr[x-1][32]; int ans=0; int adans=0; adans=std::min(a,c); ans+=adans; a-=adans; c-=adans; adans=std::min(b,e); ans+=adans; b-=adans; e-=adans; adans=std::min(d,f); ans+=adans; d-=adans; f-=adans; ans+=(a+b)*2; return ans; }

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

dna.cpp: In function 'int cod(char)':
dna.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^
#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...