CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:Capibari
Submission time:2020-10-01 17:30:28 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.01 sdetails
#20.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 < s.length(); 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 = 'a' - 1;
for(ll i = 0; i < s.length(); i = s.find_first_not_of(c, i)) {
c = s[i];
if(!(s.find_first_of(c) - s.find_last_of(c)) & 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:

input
1000
korvata
sopimusaika
nuhatartunta
korttiautomaatti
...

correct output
15

user output
18

Test 2

Verdict:

input
1000
pub
hansikaslokero
erikoisvalmisteinen
unijukka
...

correct output
42

user output
43

Test 3

Verdict: ACCEPTED

input
1000
haapalastu
toipumisaika
mustalaiskieli
taidelainaamo
...

correct output
70

user output
70