QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418837 | #5119. Perfect Word | reverSilly | WA | 0ms | 3740kb | C++23 | 766b | 2024-05-23 16:02:36 | 2024-05-23 16:02:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int mxn{100005};
int n;
unordered_set<string_view>S;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin>>n;
for(int i=0;i<n;++i)
{
string *s=new string;
cin>>*s;
S.insert(*s);
}
int ans=0;
for(string_view s:S)
{
if(s.length()<=sqrt(n)+1)
{
for(int i=0;i<s.length();++i)
{
for(int j=1;i+j<=s.length();++j)
{
if(!S.contains(string_view(&s[i],j)))
goto nx;
}
}
ans=max(ans,(int)s.length());
}
nx:;
}
cout<<ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
4 a t b ab
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3740kb
input:
310 a aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaaaa aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaa...
output:
18
result:
wrong answer 1st numbers differ - expected: '300', found: '18'