Submission #165775

# Submission time Handle Problem Language Result Execution time Memory
165775 2019-11-28T16:35:59 Z muhi1112 Lozinke (COCI17_lozinke) C++17
65 / 100
1000 ms 1652 KB
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=405;

int n,ans;
string s;
vector<string>str;
map<string,int>cnt;

int main(){
	//fri("in.txt");
	//fro("out.txt");
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		str.pb(s);
	}
	for(int i=0;i<n;i++){
		if(cnt[str[i]]!=0){
			ans+=cnt[str[i]];
			continue;
		}
		for(int j=0;j<n;j++){
			if(j!=i && str[j].length()>=str[i].length() && str[j].find(str[i])!=string::npos){
				ans++;
				cnt[str[i]]++;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 19 ms 376 KB Output is correct
6 Correct 44 ms 504 KB Output is correct
7 Correct 59 ms 504 KB Output is correct
8 Correct 42 ms 504 KB Output is correct
9 Correct 957 ms 1364 KB Output is correct
10 Execution timed out 1018 ms 1236 KB Time limit exceeded
11 Execution timed out 1082 ms 1264 KB Time limit exceeded
12 Execution timed out 1076 ms 1648 KB Time limit exceeded
13 Execution timed out 1049 ms 1648 KB Time limit exceeded
14 Execution timed out 1078 ms 1648 KB Time limit exceeded
15 Execution timed out 1075 ms 1644 KB Time limit exceeded
16 Correct 736 ms 1652 KB Output is correct
17 Correct 57 ms 1648 KB Output is correct
18 Correct 22 ms 1644 KB Output is correct
19 Execution timed out 1073 ms 1648 KB Time limit exceeded
20 Correct 510 ms 1648 KB Output is correct