제출 #1009447

#제출 시각아이디문제언어결과실행 시간메모리
1009447induwara16Mutating DNA (IOI21_dna)C++17
0 / 100
1532 ms3408 KiB
#include "dna.h"
#include <bits/stdc++.h>

using namespace std;

typedef string str;
typedef vector<int> vi;

str a, b;

void init(std::string a1, std::string b2)
{
	a = a1;
	b = b2;
}

int solve(str a, str b, int c)
{
	;
}

int get_distance(int x, int y)
{
	str a1 = a.substr(x, y);
	str b1 = b.substr(x, y);
	int n = a1.length(), c = 0;

	int as = count(a1.begin(), a1.end(), 'A');
	int cs = count(a1.begin(), a1.end(), 'C');
	int ts = count(a1.begin(), a1.end(), 'T');

	if (
		(as != count(b1.begin(), b1.end(), 'A')) ||
		(cs != count(b1.begin(), b1.end(), 'C')) ||
		(ts != count(b1.begin(), b1.end(), 'T')))
	{
		return -1;
	}

	vi cc = {as, cs, ts};
	int ccc = count(cc.begin(), cc.end(), 0);

	if (ccc == 2)
		return 0;

	if (ccc == 1)
		return 1;

	bool same = false;
	for (int i = 0; i < n; i++)
	{
		if (a1[i] == b1[i])
		{
			same = true;
			break;
		}
	}

	return same ? 1 : 2;
}

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

dna.cpp: In function 'int solve(str, str, int)':
dna.cpp:20:1: warning: no return statement in function returning non-void [-Wreturn-type]
   20 | }
      | ^
dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:26:23: warning: unused variable 'c' [-Wunused-variable]
   26 |  int n = a1.length(), c = 0;
      |                       ^
#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...