# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078664 | khactrung1912 | Lozinke (COCI17_lozinke) | C++14 | 1068 ms | 1624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll vector<long long, long long>
#define fi first
#define se second
const int maxn = 2e4 + 10;
const int mod = 1e9 + 7;
const int inf = 1e9;
long long n,m,p,ans,l[maxn];
string a,b,s[maxn];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
//freopen("PASS.INP","r",stdin);
//freopen("PASS.OUT","w",stdout);
cin>>n;
for (int i=1; i<=n; i++) cin>>s[i],l[i]=s[i].size();
for (int i=1; i<=n-1; i++)
for (int j=i+1; j<=n; j++)
{
a=s[i]; b=s[j]; p=l[i]; m=l[j];
if (p==m)
{
if (a==b) ans+=2;
continue;
}
if (p>m)
{
swap(a,b); swap(p,m);
}
b+=a;
if (b.find(a)!=m) ans++;
}
cout<<ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |