# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472766 | MamdouhN | Lozinke (COCI17_lozinke) | C++14 | 1097 ms | 6556 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int n,ans;
string password[200002];
map<string,bool>idk;
void check(string a,string b)
{
idk.clear();
string x;
for(int i=0;i<a.size();i++)
{
x+=a[i];
if(x.size()<=b.size())idk[x]=1;
string y;
int j = i;
while(j>=0&&y.size()>b.size())
{
y=a[j]+y;
idk[y]=1;
j--;
}
}
if(idk[b])ans++;
}
main()
{
cin>>n;
for(int i=0;i<n;i++)cin>>password[i];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(j==i)continue;
if(password[j].size()>password[i].size())continue;
//cout<<password[i]<<" "<<password[j]<<endl;
check(password[i],password[j]);
//cout<<ans<<endl;
}
}
cout<<ans<<endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |