CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:motsgar
Submission time:2020-09-30 12:46:17 +0300
Language:Node.js
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.45 sdetails
#20.45 sdetails
#30.45 sdetails

Code

const readline = require('readline');

const input = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
	terminal: false
});

let output = 0;
let inputAmount = 0;
let inputtedValues = 0;
let firstLine = true;

input.on('line', function (line) {
	if (firstLine) {
		inputAmount = parseInt(line);
		firstLine = false;
	} else {
		let characters = {};
		for (let i = 0; i < line.length; i++) {
			if (characters[line.charAt(i)] != undefined) {
				characters[line.charAt(i)]++;
			} else characters[line.charAt(i)] = 1;
		}
		let hasEven = true;
		Object.values(characters).forEach(val => {
			if (val % 2 != 0) hasEven = false;
		});
		if (hasEven) output++;
		inputtedValues++;
		if (inputtedValues == inputAmount) {
			console.log(output);
			process.exit(1);
		}
	}
});

Test details

Test 1

Verdict:

input
1000
korvata
sopimusaika
nuhatartunta
korttiautomaatti
...

correct output
15

user output
15

Test 2

Verdict:

input
1000
pub
hansikaslokero
erikoisvalmisteinen
unijukka
...

correct output
42

user output
42

Test 3

Verdict:

input
1000
haapalastu
toipumisaika
mustalaiskieli
taidelainaamo
...

correct output
70

user output
70