CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:Capibari
Submission time:2020-10-01 17:48:11 +0300
Language: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 'bool r(std::__cxx11::string)':
input/code.cpp:6:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(ll i = 0; i != string::npos; i = s.find_first_not_of(c, i)) {
                   ~~^~~~~~~~~

Code

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
bool r(string s) {
    char c = 0;
    for(ll i = 0; i != string::npos; i = s.find_first_not_of(c, i)) {
        c = s[i];
        ll n =  s.find_last_of(c) - s.find_first_of(c);
        if(!(n & 1)) {
            return false;
        }
        
    }
    return true;
}
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    ll n,c=0;
    string s;
    vector<string> ss;
    cin>>n;
    for (ll i = 0; i < n; i++)
    {
        cin>>s;
        sort(s.begin(), s.end());
        ss.push_back(s);
    }
    for (auto &&e : ss)
    {   
        if(r(e))
            c++;
    }
    cout << c;
    
}

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