제출 #437500

#제출 시각아이디문제언어결과실행 시간메모리
437500grtMutating DNA (IOI21_dna)C++17
35 / 100
54 ms7680 KiB
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

const int nax = 100 * 1000 + 10;
int cnt[nax][10];
int cur[10];
map<char,int>odp;

void init(string a, string b) {
	odp['A'] = 0;
	odp['T'] = 1;
	odp['C'] = 2;
	for(int i = 1; i <= (int)a.size(); ++i) {
		for(int j = 0; j < 9; ++j) {
			cnt[i][j] = cnt[i - 1][j];
		}
		int x = odp[a[i - 1]] * 3 + odp[b[i - 1]];
		cnt[i][x]++;
	}	
}

int get_distance(int x, int y) {
	y++;
	for(int i = 0; i < 9; ++i) {
		cur[i] = cnt[y][i] - cnt[x][i];
	}
	if(cur[0] + cur[3] + cur[6] != cur[0] + cur[1] + cur[2]) return -1;
	if(cur[1] + cur[4] + cur[7] != cur[3] + cur[4] + cur[5]) return -1;
	if(cur[2] + cur[5] + cur[8] != cur[6] + cur[7] + cur[8]) return -1;
	int ans = 0;
	ans = max(cur[1], cur[3]) + max(cur[2], cur[6]) + max(cur[5], cur[7]);
	return ans;
}

#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...