Task: | Sanalista |
Sender: | mikkopal |
Submission time: | 2020-09-29 12:21:39 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'bool ok(std::vector<char>)': input/code.cpp:15:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i=1; i<v.size();i++){ ~^~~~~~~~~
Code
#include<bits/stdc++.h> #include <iostream> #include <vector> #include <iterator> using namespace std; typedef long long ll; const int mx = 1e5; bool ok(vector<char> v){ char curr=v[0]; int cnt=1; for (int i=1; i<v.size();i++){ if (v[i]==curr){ ++cnt; }else{ if (cnt%2){ return false; cnt=1; curr=v[i]; } } } return true; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); #ifndef ONLINE_JUDGE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif int n; cin >> n; int ans=0; for (int i=0; i<n; i++){ string s; cin >> s; vector<char> v(s.begin(), s.end()); sort(v.begin(),v.end()); bool b = ok(v); if (b && v.size()>1){ ans+=1; } } cout << ans; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
396 |
Test 2
Verdict: WRONG ANSWER
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
379 |
Test 3
Verdict: WRONG ANSWER
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
402 |