QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665007#5599. Repetitive Songenze114514WA 0ms3708kbC++20574b2024-10-22 00:28:472024-10-22 00:28:47

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 00:28:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2024-10-22 00:28:47]
  • 提交

answer

#include <iostream>
#include <unordered_map>
#include <string>

int main() {
    int n;
    std::cin >> n;
    std::unordered_map<std::string, int> word_count;
    std::string word;
    int unique_once = 0; 
    for (int i = 0; i < n; ++i) {
        std::cin >> word;
        word_count[word]++;
    }
    for (const auto& entry : word_count) {
        if (entry.second == 1) {
            unique_once++;
        }
    }
    int result = n - unique_once;
  
    if (result >= n) result = n - 1;
    std::cout << result << std::endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

10
bow
bow
chick
chicka
chicka
bow
bow
chick
chicka
chicka

output:

9

result:

ok single line: '9'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3708kb

input:

31
head
shoulders
knees
and
toes
knees
and
toes
head
shoulders
knees
and
toes
knees
and
toes
eyes
and
ears
and
mouth
and
nose
head
shoulders
knees
and
toes
knees
and
toes

output:

27

result:

wrong answer 1st lines differ - expected: '29', found: '27'