QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#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;
}
详细
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'