CSES - COCI 2006/2007 #6 - Results
Submission details
Task:Prase
Sender:untokarila
Submission time:2019-07-25 16:22:55 +0300
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>

using namespace std;

map<string, int> k;

int main(){

    int n, sum = 0, a = 0;
    cin >> n;

    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        if(k[s]>sum-k[s]) a++;
        k[s]++; sum++;
    }

    cout << a;
    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
15
lamjb
lamjb
fwwox
lamjb
...

correct output
7

user output
7

Test 2

Verdict: ACCEPTED

input
33
cjukktvop
kiqkjeyi
cjukktvop
cjukktvop
...

correct output
9

user output
9

Test 3

Verdict: ACCEPTED

input
77
viqafjnw
qsuxzkm
tuhrdtuy
tuhrdtuy
...

correct output
15

user output
15

Test 4

Verdict: ACCEPTED

input
85
aakpckeajzxecvwwrfrf
mrfplkgoeqbvfxawbbbp
houyionbiqxcetvzodfo
mrfplkgoeqbvfxawbbbp
...

correct output
22

user output
22

Test 5

Verdict: ACCEPTED

input
100
lovro
lovro
luka
luka
...

correct output
25

user output
25