QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#418837#5119. Perfect WordreverSillyWA 0ms3740kbC++23766b2024-05-23 16:02:362024-05-23 16:02:36

Judging History

你现在查看的是最新测评结果

  • [2024-05-23 16:02:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-05-23 16:02:36]
  • 提交

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'