QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213631 | #5119. Perfect Word | ucup-team1001# | WA | 0ms | 3848kb | C++20 | 982b | 2023-10-14 15:14:23 | 2023-10-14 15:14:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int maxn = 1e5;
#define rep(i, a, b) for(int i = (a); i <= (b); ++i)
int n;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
vector<unordered_set<string_view>> v(450);
rep(i, 1, n) {
string s;
cin >> s;
auto sz = s.size();
if (sz < 450) {
v[sz].emplace(s);
}
}
unordered_set<string_view> last(v[1]);
rep(i, 2, 450 - 1) {
// cout<<i<<endl;
// for(auto&&s:last){
// cout<<s;
// }
unordered_set<string_view> now;
for (auto &&s: v[i]) {
if (last.contains(string_view(s.begin(), s.end() - 1)) &&
last.contains(string_view(s.begin() + 1, s.end()))) {
now.emplace(s);
}
}
if (now.empty()) {
cout << i - 1;
return 0;
}
last = now;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3848kb
input:
4 a t b ab
output:
1
result:
wrong answer 1st numbers differ - expected: '2', found: '1'