답안 #165776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165776 2019-11-28T16:47:16 Z muhi1112 Lozinke (COCI17_lozinke) C++17
40 / 100
1000 ms 1780 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;

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s;
		str.pb(s);
	}
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(str[j].length()>=str[i].length() && str[j].find(str[i])!=string::npos){
				ans++;
				//cnt[str[i]]++;
			}
			if(str[i].length()>=str[j].length() && str[i].find(str[j])!=string::npos){
				ans++;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 5 ms 380 KB Output is correct
5 Correct 21 ms 376 KB Output is correct
6 Correct 56 ms 504 KB Output is correct
7 Correct 70 ms 504 KB Output is correct
8 Correct 50 ms 504 KB Output is correct
9 Execution timed out 1071 ms 1016 KB Time limit exceeded
10 Execution timed out 1069 ms 1016 KB Time limit exceeded
11 Execution timed out 1067 ms 1144 KB Time limit exceeded
12 Execution timed out 1078 ms 1144 KB Time limit exceeded
13 Execution timed out 1080 ms 1652 KB Time limit exceeded
14 Execution timed out 1076 ms 1652 KB Time limit exceeded
15 Execution timed out 1075 ms 1652 KB Time limit exceeded
16 Execution timed out 1071 ms 1780 KB Time limit exceeded
17 Execution timed out 1088 ms 1652 KB Time limit exceeded
18 Execution timed out 1075 ms 1656 KB Time limit exceeded
19 Execution timed out 1066 ms 1648 KB Time limit exceeded
20 Execution timed out 1078 ms 1652 KB Time limit exceeded