Task: | Sanalista |
Sender: | HJfod |
Submission time: | 2020-09-30 12:25:38 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
Code
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <chrono> // g++ A.cpp -o A.exe -std=c++17 -O2 -Wall; ./A.exe int main() { int c; std::cin >> c; // sanojen määrä // ota sanojen määrän verran sisään sanoja ja laita ne hauskaan vektoriin std::vector<std::string> words; std::string input; for (int i = 0; i < c; i++) { std::cin >> input; words.push_back(input); } // käy läpi kaikki sanat ja laske esiintymiset int accept_count = 0; for (unsigned long w = 0; w < words.size(); w++) { bool is = true; std::string checked = ""; for (unsigned long ch = 0; ch < words[w].length(); ch++) if (checked.find(words[w].at(ch), 0) == std::string::npos) { // herkullinen yhden rivin koodi nam nam if (std::count(words[w].begin(), words[w].end(), words[w].at(ch)) % 2 != 0) is = false; checked += words[w].at(ch); } if (is) accept_count++; } std::cout << accept_count << std::endl; return 0; }
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 |