# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
80269 | pamaj | Lozinke (COCI17_lozinke) | C++14 | 1091 ms | 2752 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
// struct node
// {
// bool ok = false;
// node *b[26];
// };
// bool find(const string& s)
// {
// }
// bool insert(const string& s, node* a)
// {
// for(auto u : s)
// {
// }
// }
bool find(const string& a, const string& b)
{
if(a.size() < b.size()) return false;
for(int i = 0; i < a.size(); i++)
{
bool ok = false;
for(int j = 0; j < b.size(); j++)
{
if(i + j >= a.size()) break;
if(a[i + j] != b[j])
break;
if(j == b.size() - 1) return true;
}
}
return false;
}
int main()
{
ios::sync_with_stdio(false), cin.tie(nullptr);
int n;
cin >> n;
vector<string> ps;
int ans = 0;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
ps.push_back(s);
}
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
if(i == j) continue;
if(find(ps[i],ps[j])) ans++;
}
}
cout << ans << "\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |