# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472999 | MamdouhN | Lozinke (COCI17_lozinke) | C++17 | 1100 ms | 65540 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
int n,ans;
string password[20005];
//map<string,bool>idk;
map<string,map<string,bool>>idk;
void get_subs(string s)
{
string x;
for(int i=0;i<s.size();i++)
{
x+=s[i];
idk[s][x]=1;
string y;
int j = i;
while(j>=0&&y.size()<s.size())
{
y=s[j]+y;
idk[s][y]=1;
j--;
}
}
}
void check(string a,string b)
{
if(idk[a][b])ans++;
}
main()
{
cin>>n;
for(int i=0;i<n;i++)cin>>password[i];
for(int i=0;i<n;i++)
{
get_subs(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... |