# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1067187 | Celebi_276 | Lozinke (COCI17_lozinke) | C++17 | 303 ms | 16748 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <algorithm>
#include <iostream>
#include <climits>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
using namespace std;
#define MultiTest(k) int k; cin >> k; while (k--)
#define all(v) v.begin(), v.end()
#define ll long long int
#define pll pair<ll, ll>
#define pii pair<int, int>
#define NAME ""
string s[20022];
int n, Z(0);
map <string, int> mp, ok;
void process (string s) {
int l = s.length();
vector <string> C;
for (int i = 0; i < l; i++)
for (int j = i; j < l; j++) {
string t = s.substr(i, j - i + 1);
if (!ok[t]) C.push_back(t);
ok[t] = 1;
}
for (string t : C) mp[t]++;
ok.clear();
}
signed main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
if (fopen(NAME".INP", "r"))
{
freopen(NAME".INP", "r", stdin);
freopen(NAME".OUT", "w", stdout);
}
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s[i];
process(s[i]);
}
for (int i = 1; i <= n; i++) Z += mp[s[i]];
cout << Z - n;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |