CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:Ulrikaz
Submission time:2020-09-30 09:35:43 +0300
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:20:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int j = 0; j < a.size(); ++j) {
                    ~~^~~~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

map<char, int> m[1001];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin >> n;
	
	int r = 0;
	for (int i = 1; i <= n; ++i) {
		string a;
		cin >> a;
		
		if (a.size() % 2 == 0) {
			for (int j = 0; j < a.size(); ++j) {
				char b = a[j];

				if (m[i].count(b)) {
					m[i][b] += 1;
				} else {
					m[i][b] = 1;
				}
			}
			int t = 0;
			for (auto k: m[i]) {
				if (k.second % 2 == 1) {
					++t;		
				}	
			}
			if (t == 0) ++r;
		}
	}
	cout << r << '\n';
}

Test details

Test 1

Verdict: ACCEPTED

input
1000
korvata
sopimusaika
nuhatartunta
korttiautomaatti
...

correct output
15

user output
15

Test 2

Verdict: ACCEPTED

input
1000
pub
hansikaslokero
erikoisvalmisteinen
unijukka
...

correct output
42

user output
42

Test 3

Verdict: ACCEPTED

input
1000
haapalastu
toipumisaika
mustalaiskieli
taidelainaamo
...

correct output
70

user output
70