제출 #499830

#제출 시각아이디문제언어결과실행 시간메모리
499830sazid_alamDNA 돌연변이 (IOI21_dna)C++17
0 / 100
33 ms6252 KiB
#include "dna.h"
#include <bits/stdc++.h>
using namespace std;

string a, b;
int tot[100005][3][2], bad[100005];

void init(string u, string v) {
    for(int i = 0; i < u.size(); i++){
        bad[i + 1] += bad[i];
        if(u[i] != v[i]) bad[i + 1]++;
        if(u[i] == 'A') tot[i + 1][0][0]++;
        if(v[i] == 'A') tot[i + 1][0][1]++;
        if(u[i] == 'C') tot[i + 1][1][0]++;
        if(v[i] == 'C') tot[i + 1][1][1]++;
        if(u[i] == 'T') tot[i + 1][2][0]++;
        if(v[i] == 'T') tot[i + 1][2][1]++;
    }
}

int get_distance(int x, int y) {

    for(int j = 0; j < 3; j++){
        if(tot[y + 1][j][0] - tot[x][j][0] != tot[y + 1][j][1] - tot[x][j][1]) return -1;
    }

    return (bad[y + 1] - bad[x] + 1) / 2;
}

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

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