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

Code

#pragma GCC optimize("O3")
#pragma GCC target("sse4")

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

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    int n, ans = 0;
    cin >> n;
    string s;
    for (int i = 0; i < n; ++i) {
        cin >> s;
        if (s.size() % 2 == 1)
            continue;
        else {
            int c[27] = { 0 };

            for (char j : s)
                c[j-'a']++;

            bool valid = true;
            for (int k : c) {
                if (k % 2 == 1) {
                    valid = false;
                    break;
                }
            }

            if (valid)
                ans++;

        }
    }

    cout << ans;
}

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