CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:jusola
Submission time:2020-09-28 10:41:21 +0300
Language:C++ (C++17)
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:19:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int j = 0; j < w.length(); j++){
                         ~~^~~~~~~~~~~~

Code

#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(){
    int n, o = 0;
    cin >> n;
    string w;
    for (int i = 0; i < n; i++){
        bool b = true;
        cin >> w;
        if(w.length() % 2 != 0){
            continue;
        }

        map<char, int> a;
        for (int j = 0; j < w.length(); j++){
            char c = w[j];
            a[c] += 1;
        }

        for (auto const& x : a){
            if(x.second % 2 != 0){
                b = false;
                break;
            }
        }
        if(b) o++;
    }
    cout << o;
}

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