CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:AleksandrPolitov
Submission time:2020-10-05 10:53:20 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.01 sdetails
#20.01 sdetails
#30.01 sdetails

Compiler report

input/code.cpp: In function 'void solve(std::__cxx11::string)':
input/code.cpp:12:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < word.size(); i++)
                     ~~^~~~~~~~~~~~~

Code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int r = 0;

void solve(string word) {
    vector<char> v;
    for (int i = 0; i < word.size(); i++)
    {
        auto f = find(v.begin(), v.end(), word[i]);
        if (f != v.end()) {
            int index = distance(v.begin(), f);
            v.erase(v.begin() + index);
        }
        else {
            v.push_back(word[i]);
        }
    }
    if (v.size() == 0)
        r++;
}

//5
//huuliharppu
//kirppusirkus
//oskilloskooppi
//papukaija
//tieteellinen

int main()
{
    int c;
    string word;
    cin >> c;
    for (int i = 0; i < c; i++) {
        getline(cin, word);
        if (word.length() % 2 == 0)
            solve(word);
    }
    cout << r;
}

Test details

Test 1

Verdict:

input
1000
korvata
sopimusaika
nuhatartunta
korttiautomaatti
...

correct output
15

user output
16

Test 2

Verdict:

input
1000
pub
hansikaslokero
erikoisvalmisteinen
unijukka
...

correct output
42

user output
43

Test 3

Verdict:

input
1000
haapalastu
toipumisaika
mustalaiskieli
taidelainaamo
...

correct output
70

user output
71