# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
472780 | _L__ | Lozinke (COCI17_lozinke) | C++17 | 889 ms | 16452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// This code is written by _L__
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type , less<T> , rb_tree_tag , tree_order_statistics_node_update>;
#define endl '\n'
#define F_word ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
typedef long long ll;
typedef long double ld;
const ll mod = 1e9+7, N = 1e5+300, inf = 1e18;
const ld E = 1e-6;
#define ff first
#define ss second
int main(void){
F_word;
int n; cin >> n;
string arr[n];
map<string, int> freq;
for(int i = 0; i < n; ++i){
cin >> arr[i];
map<string, bool> shown;
for(int j = 0; j < arr[i].size(); ++j){
string s = "";
for(int k = j; k < arr[i].size(); ++k){
s += arr[i][k];
if(!shown[s]){freq[s]++;shown[s] = 1;}
}
}
}
ll ans = 0;
for(int i = 0; i < n; ++i){
for(int j = 0; j < arr[i].size(); ++j){
string s = "";
for(int k = j; k < arr[i].size(); ++k){
s += arr[i][k];
freq[s]--;
}
}
//if(freq[arr[i]]) cout << arr[i] << endl;
ans += freq[arr[i]];
for(int j = 0; j < arr[i].size(); ++j){
string s = "";
for(int k = j; k < arr[i].size(); ++k){
s += arr[i][k];
freq[s]++;
}
}
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |