CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:shmoul
Submission time:2020-10-01 13:25:01 +0300
Language:C++ (C++11)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:18:51: error: no matching function for call to 'find(std::__cxx11::list<char>::iterator, std::__cxx11::list<char>::iterator, char&)'
    if (std::find(checked.begin(), checked.end(), c) != checked.end()) continue;
                                                   ^
In file included from /usr/include/c++/7/bits/locale_facets.h:48:0,
                 from /usr/include/c++/7/bits/basic_ios.h:37,
                 from /usr/include/c++/7/ios:44,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from input/code.cpp:1:
/usr/include/c++/7/bits/streambuf_iterator.h:369:5: note: candidate: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
     find(istreambuf_iterator<_CharT> __first,
     ^...

Code

#include <iostream>
#include <list>
int main()
{
	int count = 0;
	int wordcount;
	std::cin >> wordcount;
	for (; wordcount > 0; wordcount--)
	{
		std::string temp;
		std::cin >> temp;
		int length = temp.size();
		std::list<char> checked;
		for (int i = 0; i < length; i++)
		{
			bool even = true;
			char c = temp[i];
			if (std::find(checked.begin(), checked.end(), c) != checked.end()) continue;
			checked.push_back(c);
			for (int j = i; j < length; j++)
			{
				if (temp[j] == c) even = !even;
			}
			if (!even) goto stop;
		}
		count++;
		stop: continue;
	}
	std::cout << count;
	return 0;
}