# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
80253 | MatheusLealV | Lozinke (COCI17_lozinke) | C++17 | 632 ms | 15788 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define N 20050
using namespace std;
typedef long long ll;
int n;
ll ans;
unordered_map<string, int> mapa;
string v[N];
int main()
{
ios::sync_with_stdio(false); cin.tie(0);
cin>>n;
for(int t = 1; t <= n; t++)
{
string s;
unordered_set<string> ss;
cin>>s;
v[t] = s;
ans += (ll)mapa[s];
for(int i = 0; i < s.size(); i++)
{
string aux;
for(int j = i; j < s.size(); j++)
{
aux.push_back(s[j]);
ss.insert(aux);
}
}
for(auto x: ss) mapa[x] ++;
}
mapa.clear();
for(int t = n; t >= 1; t--)
{
string s = v[t];
unordered_set<string> ss;
ans += (ll)mapa[s];
for(int i = 0; i < s.size(); i++)
{
string aux;
for(int j = i; j < s.size(); j++)
{
aux.push_back(s[j]);
ss.insert(aux);
}
}
for(auto x: ss) mapa[x] ++;
}
cout<<ans<<"\n";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |