Submission #1009505

#TimeUsernameProblemLanguageResultExecution timeMemory
1009505induwara16DNA 돌연변이 (IOI21_dna)C++17
Compilation error
0 ms0 KiB
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 = n - as - cs;

	if ((as == n) || (cs == n) || (ts == n))
		return 0;

	if ((as == 0) || (cs == 0) || (ts == 0))
		return 1;

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

	return same ? 1 : 2;
}

Compilation message (stderr)

dna.cpp: In function 'int get_distance(int, int)':
dna.cpp:3:2: error: 'str' was not declared in this scope; did you mean 'std'?
    3 |  str a1 = a.substr(x, y);
      |  ^~~
      |  std
dna.cpp:4:5: error: expected ';' before 'b1'
    4 |  str b1 = b.substr(x, y);
      |     ^~~
      |     ;
dna.cpp:5:10: error: 'a1' was not declared in this scope
    5 |  int n = a1.length(), c = 0;
      |          ^~
dna.cpp:7:11: error: 'count' was not declared in this scope
    7 |  int as = count(a1.begin(), a1.end(), 'A');
      |           ^~~~~
dna.cpp:20:16: error: 'b1' was not declared in this scope
   20 |   if (a1[i] == b1[i])
      |                ^~