QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#507183 | #5499. Aliases | NYCU_MyGO# | WA | 36ms | 5332kb | C++20 | 1022b | 2024-08-06 12:47:36 | 2024-08-06 12:47:37 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define matsuri pair<int,int>
//const int iris = 1e9+7;
const int iris = 998244353;
using namespace std;
void solve()
{
int n;
cin>>n;
vector<string> arr(n),aoi(n);
int a=1e9, b=1e9;
for(int i=0;i<n;i++)
cin>>arr[i]>>aoi[i];
int ans=6, xx=0, yy=0, zz=6;
vector<int> pd(7,1);
for(int i=1;i<=6;i++)
pd[i]=pd[i-1]*10;
for(int i=0;i<ans;i++)
{
for(int j=0;i+j<ans;j++)
{
for(int k=0;i+j+k<ans;k++)
{
map<string,int> cnt;
int ono=0;
for(int o=0;o<n;o++)
{
string cur;
for(int _=0;_<min(i, (int)arr[o].size());_++)
cur+=arr[o][_];
for(int _=0;_<min(j, (int)aoi[o].size());_++)
cur+=aoi[o][_];
ono=max(ono, ++cnt[cur]);
}
if(ono<=pd[k] && i+j+k<ans)
ans=i+j+k, xx=i, yy=j, zz=k;
}
}
}
cout<<xx<<' '<<yy<<' '<<zz<<'\n';
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T=1;
cin>>T;
while(T--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
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: 36ms
memory: 5332kb
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 0 0 0 5 0 1 1 1 0 2 1 1 1 2 0 1
result:
wrong answer Loginy nie moga byc puste! (test case 1)