# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
80269 | 2018-10-19T17:06:44 Z | pamaj | Lozinke (COCI17_lozinke) | C++14 | 1000 ms | 2752 KB |
#include <bits/stdc++.h> using namespace std; // struct node // { // bool ok = false; // node *b[26]; // }; // bool find(const string& s) // { // } // bool insert(const string& s, node* a) // { // for(auto u : s) // { // } // } bool find(const string& a, const string& b) { if(a.size() < b.size()) return false; for(int i = 0; i < a.size(); i++) { bool ok = false; for(int j = 0; j < b.size(); j++) { if(i + j >= a.size()) break; if(a[i + j] != b[j]) break; if(j == b.size() - 1) return true; } } return false; } int main() { ios::sync_with_stdio(false), cin.tie(nullptr); int n; cin >> n; vector<string> ps; int ans = 0; for(int i = 0; i < n; i++) { string s; cin >> s; ps.push_back(s); } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(i == j) continue; if(find(ps[i],ps[j])) ans++; } } cout << ans << "\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 412 KB | Output is correct |
4 | Correct | 5 ms | 468 KB | Output is correct |
5 | Correct | 27 ms | 468 KB | Output is correct |
6 | Correct | 72 ms | 624 KB | Output is correct |
7 | Correct | 82 ms | 628 KB | Output is correct |
8 | Correct | 73 ms | 720 KB | Output is correct |
9 | Execution timed out | 1066 ms | 1252 KB | Time limit exceeded |
10 | Execution timed out | 1072 ms | 1320 KB | Time limit exceeded |
11 | Execution timed out | 1071 ms | 1400 KB | Time limit exceeded |
12 | Execution timed out | 1064 ms | 1624 KB | Time limit exceeded |
13 | Execution timed out | 1091 ms | 2272 KB | Time limit exceeded |
14 | Execution timed out | 1064 ms | 2576 KB | Time limit exceeded |
15 | Execution timed out | 1069 ms | 2592 KB | Time limit exceeded |
16 | Execution timed out | 1067 ms | 2624 KB | Time limit exceeded |
17 | Execution timed out | 1090 ms | 2752 KB | Time limit exceeded |
18 | Execution timed out | 1082 ms | 2752 KB | Time limit exceeded |
19 | Execution timed out | 1088 ms | 2752 KB | Time limit exceeded |
20 | Execution timed out | 1081 ms | 2752 KB | Time limit exceeded |