QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#768743#5119. Perfect WordfosovWA 2ms4120kbC++14951b2024-11-21 14:10:252024-11-21 14:10:25

Judging History

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

  • [2024-11-21 14:10:25]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:4120kb
  • [2024-11-21 14:10:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long 
#define lll __int128
#define INF 0x3f3f3f3f
#define LNF 0x3f3f3f3f3f3f3f3fll
#define MOD 998244353
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define fi first
#define se second
#define all(a) a.begin(), a.end()

#define N 5050

int f(ll x) {
    if (!x) return 1;
    if (x%3) return f(x-1)+1;
    return f(x/3)+1;
}

int main() {
#ifdef TEST
    freopen("zz.in", "r+", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n; cin >> n;
    set<string> s;
    int res = 1;
    for (int i = 0; i < n; ++ i) {
        string t; cin >> t;
        s.insert(t);
        if (t.length() == 1) continue;
        if (s.count(t.substr(0, t.length()-1)) && s.count(t.substr(1, t.length()-1))) {
            res = max(res, (int) t.length());
        }
    }
    cout << res << '\n';
}   

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

input:

4
a
t
b
ab

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3720kb

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:

300

result:

ok 1 number(s): "300"

Test #3:

score: -100
Wrong Answer
time: 2ms
memory: 4120kb

input:

4347
bbaaaab
aabab
bbaaaaababaaaba
aababaaaabbbabababaaaba
ababbabbbbbabbbabbab
bbbbbbb
bbbabbbabbabaab
aabbbbabbbbaa
aabaaabbbbbabaaababaa
aaabababba
aaababbaabab
abbababbabbab
bababaabbbbaaa
aaaaaabaaaababaa
ababaababba
babaababbbababaaab
bb
abbbaaaababa
b
ab
aaabbbbb
abaabaaaaababbbab
bbaaabaab
b...

output:

12

result:

wrong answer 1st numbers differ - expected: '10', found: '12'