# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
917960 | 406 | Lozinke (COCI17_lozinke) | C++17 | 254 ms | 35904 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int int64_t
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
using namespace std;
using ar = array<int, 2>;
const int64_t INF = 1ll << 60;
const int N = 2e4 + 5;
string s[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<string> V;
FOR(i, 0, n) {
cin >> s[i];
vector<string> v;
FOR(k, 0, s[i].size()) {
string a;
FOR(j, k, s[i].size()) {
a += s[i][j];
v.push_back(a);
}
}
sort(v.begin(), v.end());
v.resize(unique(v.begin(), v.end()) - v.begin());
V.insert(V.end(), v.begin(), v.end());
}
sort(V.begin(), V.end());
int ans = -n;
FOR(i, 0, n) {
int L = lower_bound(V.begin(), V.end(), s[i]) - V.begin();
int R = upper_bound(V.begin(), V.end(), s[i]) - V.begin();
ans += R - L;
}
cout << ans << '\n';
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |