제출 #807722

#제출 시각아이디문제언어결과실행 시간메모리
807722vjudge1DNA 돌연변이 (IOI21_dna)C++17
100 / 100
32 ms7400 KiB
#include "dna.h" using namespace std; int dp[100100][3][3]; void init(string a, string b) { string key = "ACT"; for(int i = 1; i <= a.size(); i++) for(int j = 0; j < 3; j++) for(int k = 0; k < 3; k++) dp[i][j][k]=dp[i-1][j][k]+(a[i-1]==key[j]&&b[i-1]==key[k]); } int get_distance(int l, int r) { int ans=0,prev=0; for(int i = 0; i < 3; i++) { int next = (i+1)%3; int x = dp[r+1][i][next]-dp[l][i][next],y=dp[r+1][next][i]-dp[l][next][i]; if(i){ if(prev!=x-y) return -1; } else ans+=2*abs(prev=x-y); ans+=min(x,y); } return ans; }

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

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