제출 #440070

#제출 시각아이디문제언어결과실행 시간메모리
440070abekerDNA 돌연변이 (IOI21_dna)C++17
0 / 100
42 ms5628 KiB
#include <bits/stdc++.h> #include "dna.h" using namespace std; const int MAXN = 1e5 + 5; const char DNA[] = "ACT"; int cnt[MAXN][3][3]; int get_id(char c) { return strchr(DNA, c) - DNA; } void init(string a, string b) { for (int i = 0; i < a.size(); i++) { if (i) memcpy(cnt[i], cnt[i - 1], sizeof cnt[i]); cnt[i][get_id(a[i])][get_id(b[i])]++; } } int get_cnt(int x, int y, int i, int j) { return cnt[y][i][j] - (x ? cnt[x - 1][i][j] : 0); } int get_distance(int x, int y) { int res = 0; for (int i = 0; i < 3; i++) for (int j = 0; j < i; j++) { int p = get_cnt(x, y, i, j); int q = get_cnt(x, y, j, i); if (p < q) swap(p, q); res += (2 * p + q + 2) / 3; } return res; }

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

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