QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#507174 | #5499. Aliases | NYCU_MyGO# | WA | 12ms | 4280kb | C++20 | 1.0kb | 2024-08-06 12:34:38 | 2024-08-06 12:34:38 |
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];
a=min(a, (int)arr[i].size());
b=min(b, (int)aoi[i].size());
}
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<=a;i++)
{
for(int j=0;i+j<ans && j<=b;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;_<i;_++)
cur+=arr[o][_];
for(int _=0;_<j;_++)
cur+=aoi[o][_];
ono=max(ono, ++cnt[cur]);
}
if(ono<=pd[k])
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
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: 12ms
memory: 4280kb
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)