QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#627675 | #5119. Perfect Word | daoqi# | Compile Error | / | / | C++17 | 1.0kb | 2024-10-10 16:43:36 | 2024-10-10 16:43:36 |
Judging History
answer
#include<bits/stdc++.h>
using i64 = long long;
void DAOQI() {
int n;
std::cin >> n;
std::vector<std::string> str;
std::set<std::string> se;
for (int i = 1; i <= n; i++) {
std::string s;
std::cin >> s;
str.push_back(s);
se.insert(s);
}
std::sort(str.begin(), str.end(), [&](auto &x, auto &y) {
return x.size() > y.size();
});
int ans = 0;
for (auto &s: str) {
bool ok = true;
for (int i = 0; i < s.size(); i++) {
for (int j = i; j < s.size(); j++) {
if (se.contains(s.substr(i, j - i + 1))) continue;
else {
ok = false;
break;
}
}
}
if (ok) {
std::cout << s.size() << "\n";
return;
}
}
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
//std::cin >> T;
while (T--) DAOQI();
return 0;
}
詳細信息
answer.code: In function ‘void DAOQI()’: answer.code:25:24: error: ‘class std::set<std::__cxx11::basic_string<char> >’ has no member named ‘contains’ 25 | if (se.contains(s.substr(i, j - i + 1))) continue; | ^~~~~~~~