QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#199233#5499. AliasesmartaWA 70ms5428kbC++171.2kb2023-10-03 23:43:292023-10-03 23:43:29

Judging History

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

  • [2023-10-03 23:43:29]
  • 评测
  • 测评结果:WA
  • 用时:70ms
  • 内存:5428kb
  • [2023-10-03 23:43:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int t=1;

void solve()
{
    int n;
    cin>>n;
    vector<string> imie(n), nazwisko(n);
    for(int i=0; i<n; i++)
    {
        cin>>imie[i]>>nazwisko[i];
//        imie[i]+="       ";
//        nazwisko[i]+="       ";
    }

    int a=0, b=0, c=6;
    map <string, int> mapa;

    for(int i=0; i<=6; i++)
    {
        for(int j=0; j<=6; j++)
        {
            for(int k=0; k<=6; k++)
            {
                if((i+j+k)==0 or a+b+c<=i+j+k) continue;
                bool czyok=1;
                for(int ii=0; ii<n; ii++)
                {
                    string s;
                    int size1=imie[ii].size();
                    int size2=nazwisko[ii].size();
                    s+=imie[ii].substr(0, min(i, size1));
                    s+=nazwisko[ii].substr(0, min(j, size2));
                    mapa[s]++;
                    if(mapa[s]>=pow(10, k)) czyok=0;
                }
                if(czyok){a=i, b=j, c=k;}

            }
        }
    }

    cout<<a<<' '<<b<<' '<<c<<'\n';
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>t;
    while(t--) solve();

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1
11
sven eriksson
erik svensson
sven svensson
erik eriksson
bjorn eriksson
bjorn svensson
bjorn bjornsson
erik bjornsson
sven bjornsson
thor odinsson
odin thorsson

output:

0 0 2

result:

ok correct! (1 test case)

Test #2:

score: -100
Wrong Answer
time: 70ms
memory: 5428kb

input:

6
1
g u
14643
gj ek
hc bi
hi ke
ab ij
hk cj
ha bi
ag fe
eb ej
hd ei
bf gj
ke dd
ib jd
id jb
gd ei
cj bi
bi hg
ic dh
ke gk
af eg
fg dd
fe fa
be ge
hf kj
ih ci
gg jf
ed dd
eh gi
cc kd
ka fd
af gb
ka fe
ja ed
bc hi
eg cf
gg ff
kf gf
ii ch
hh ec
ei ec
cd gc
bh hb
dd id
ce bk
ib ic
bf kk
gh cd
hb he
if g...

output:

0 0 1
0 0 5
0 0 3
0 0 4
0 0 4
0 0 4

result:

wrong answer Rozwiazanie nieoptymalne! (test case 3)