Submission #222930

# Submission time Handle Problem Language Result Execution time Memory
222930 2020-04-14T10:57:42 Z baoduytran0104 Lozinke (COCI17_lozinke) C++14
40 / 100
1000 ms 1152 KB
#include <bits/stdc++.h>

using namespace std;
int n, l, t;
string s[20005], a;

int main()
{
    cin >> n;
    for(int i = 1; i <= n; ++i) cin >> s[i];
    for(int i = 1; i <= n; ++i) {
        l = s[i].length();
        for(int j = 1; j <= n; ++j) {
            if (i == j) continue;
            if (l > s[j].length()) continue;
            for(int k = 0; k <= int(s[j].length() - l); ++k) {
                a = s[j].substr(k, l);
                if (a == s[i]) {
                    t += 1;
                    break;
                }
            }
        }
    }
    cout << t;
    return 0;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:15:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (l > s[j].length()) continue;
                 ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1024 KB Output is correct
2 Correct 5 ms 896 KB Output is correct
3 Correct 6 ms 896 KB Output is correct
4 Correct 19 ms 1024 KB Output is correct
5 Correct 67 ms 896 KB Output is correct
6 Correct 143 ms 1024 KB Output is correct
7 Correct 253 ms 1036 KB Output is correct
8 Correct 218 ms 896 KB Output is correct
9 Execution timed out 1099 ms 1024 KB Time limit exceeded
10 Execution timed out 1098 ms 1024 KB Time limit exceeded
11 Execution timed out 1093 ms 1024 KB Time limit exceeded
12 Execution timed out 1092 ms 1024 KB Time limit exceeded
13 Execution timed out 1092 ms 1152 KB Time limit exceeded
14 Execution timed out 1098 ms 1152 KB Time limit exceeded
15 Execution timed out 1093 ms 1152 KB Time limit exceeded
16 Execution timed out 1091 ms 1152 KB Time limit exceeded
17 Execution timed out 1089 ms 1152 KB Time limit exceeded
18 Execution timed out 1098 ms 1152 KB Time limit exceeded
19 Execution timed out 1095 ms 1152 KB Time limit exceeded
20 Execution timed out 1088 ms 1152 KB Time limit exceeded