제출 #529188

#제출 시각아이디문제언어결과실행 시간메모리
529188Icebear16DNA 돌연변이 (IOI21_dna)C++17
0 / 100
31 ms3852 KiB
#include "dna.h" int n,q; std::string s; std::string c; void init(std::string a, std::string b) { s=a,c=b; while(q--){ int x,y; get_distance(x,y); } } int get_distance(int x, int y) { int h1,h2,l1,l2,k1,k2; for(int i=x;i<=y;i++){ if(s[i]=='A'){ h1++; }else if(s[i]=='T'){ l1++; }else if(s[i]=='C'){ k1++; } if(c[i]=='A'){ h2++; }else if(c[i]=='T'){ l2++; }else if(c[i]=='C'){ k2++; } } if(h1==h2 && l1==l2 && k1==k2){ int j=0; for(int i=x;i<=y;i++){ if(s[i]!=c[i]){ j+=1; } } if(j%2==1){ j+=1; } return j/2; }else{ return -1; } }

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

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:30:7: warning: 'h1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |  if(h1==h2 && l1==l2 && k1==k2){
      |     ~~^~~~
dna.cpp:30:7: warning: 'h2' may be used uninitialized in this function [-Wmaybe-uninitialized]
dna.cpp:30:17: warning: 'l1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |  if(h1==h2 && l1==l2 && k1==k2){
      |               ~~^~~~
dna.cpp:30:17: warning: 'l2' may be used uninitialized in this function [-Wmaybe-uninitialized]
dna.cpp:30:22: warning: 'k1' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |  if(h1==h2 && l1==l2 && k1==k2){
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~
dna.cpp:30:22: warning: 'k2' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...