제출 #1305231

#제출 시각아이디문제언어결과실행 시간메모리
1305231tabLozinke (COCI17_lozinke)C++20
40 / 100
1099 ms63648 KiB
#include "bits/stdc++.h" using namespace std; #define intt long long #define fi first #define se second const intt mxN = 2e5+1; const intt LG = 20; const intt inf = 1e18; const intt mod = 1e9 + 7; intt dx[4] = {1, -1, 0ll, 0ll}; intt dy[4] = {0, 0, 1, -1}; set<string> st[mxN]; vector<string> v; intt n; void _() { cin >> n; for(intt i = 0; i < n; i++) { string s; cin >> s; v.push_back(s); for(intt l = 0; l < s.size(); l++) { string cur = ""; for(intt r = l; r < s.size(); r++) { cur += s[r]; st[i].insert(cur); } } } // for(intt i = 0; i < n; i++) { // cout << i << ": "; // for(auto u : st[i]) cout << u << " "; // cout << endl; // } intt ans = 0; for(intt i = 0; i < n; i++) { for(intt j = 0; j < i; j++) { if(st[j].find(v[i]) != st[j].end()) ans++; } for(intt j = i + 1; j < n; j++) { if(st[j].find(v[i]) != st[j].end()) ans++; } } cout << ans << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // freopen("island.in", "r", stdin); // freopen("island.out", "w", stdout); intt t = 1, buu = 1; // cin >> t; while(t--){ // cout << "Case #" << buu++ << ": "; _(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...