QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88176 | #5499. Aliases | meaningful# | AC ✓ | 10742ms | 30288kb | C++14 | 703b | 2023-03-15 14:10:51 | 2023-03-15 14:10:55 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string a[200010],b[200010];
int main()
{
int T;
cin>>T;
while (T--)
{
int n,ans=1500000,i,j,res[3]={0,0,1};cin>>n;
for (i=1;i<=n;i++)
{
cin>>a[i]>>b[i];
}
if (n==1)
{
cout<<"0 0 1"<<endl;
continue;
}
for (i=0;i<ans;i++) for (j=0;j<ans;j++)
{
map<string,int> mp;
int mx=0;
for (int k=1;k<=n;k++)
{
string tp;
tp=a[k].substr(0,i)+b[k].substr(0,j);
mp[tp]++;
mx=max(mx,mp[tp]);
}
int tp=1,k=0;
while (tp<mx) tp*=10,k++;
if (i+j+k<=ans) ans=i+j+k,res[0]=i,res[1]=j,res[2]=k;
}
cout<<res[0]<<' '<<res[1]<<' '<<res[2]<<endl;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 6ms
memory: 15980kb
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:
1 1 0
result:
ok correct! (1 test case)
Test #2:
score: 0
Accepted
time: 103ms
memory: 17020kb
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 2 2 1 0 1 1 1 0 2 1 1 1 2 0 1
result:
ok correct! (6 test cases)
Test #3:
score: 0
Accepted
time: 456ms
memory: 20292kb
input:
6 5000 dpbcebnavonpwlkermqftinonhckqynyxfwsybsalgmpqmedykqeunbolxhtcnrvbiqrjgziptkqgbsxrprapfzjxefiioecsacujyuhvsapywqohliffaqsbupnocesbgqutaanduiztwwqulwvrx dyearafwtdkifljtvcryeyfzgqghjwhuycusqkxngmanxxjhyqaethbfoqaigbbjuutwzzazsgcguaasrrrzsapcuhvzzjllatjqtxzrotdpcrrdogfwoonxjwisdwhqntlhqpflxvcido...
output:
3 0 1 0 1 3 1 1 2 2 0 2 1 2 1 3 0 1
result:
ok correct! (6 test cases)
Test #4:
score: 0
Accepted
time: 10742ms
memory: 24748kb
input:
6 113503 hxihfx mrqehftb oqmcc bwrbqomg dokyjc kuaiu hhfubp aleme xcnbe shxaqrf kzmqym geclklta jnxjq nppjx xeloxixa owsxnnj pzlvbyuk leioq xipez hoxgsml esujubw cwwzpei fekvoee vbxlts xjhcrkx qicmbmen rskvnrcx mpzpvvye lkkmkstn wlptoh wqgvr qbryq cqxydbr fzdxdrv wzofngxt keqwwhdl fkomzb sckpev geqe...
output:
4 0 1 2 2 1 1 3 1 3 0 2 1 2 2 1 1 3
result:
ok correct! (6 test cases)
Test #5:
score: 0
Accepted
time: 7942ms
memory: 30288kb
input:
6 1331 hidkxivneczxfctnobbqpxsgneaivgbodiejoqgbdthwsdsfzkxcdtzumcfdoawihskkwkehjdezgazzphrnkgncimntusqjqwimwbsztbzceqnwmnzzezwzazakknfwvdsyglpplwgnhwcgpriuwdmbvvlxaoruuuugamntnuqlvslsgvehhegjqpkcskonosndngfkokjcrqewtzzmypimrsoqqffwwzgzwhgfrrxmtptzfnretnoqjprpgqdhxcrccphsdmouuuidojxcyiknpfrrygjgwgwkb...
output:
1 2 0 3 1 0 4 1 0 2 3 0 0 5 0 0 0 6
result:
ok correct! (6 test cases)