답안 #116815

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116815 2019-06-14T01:43:22 Z nhimnam120 Lozinke (COCI17_lozinke) C++14
5 / 100
1000 ms 1784 KB
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
vector<pair<long long, string> > inp;
signed main(){
	long long n;
	cin >> n;
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		inp.push_back({s.size(),s});
	}
	long long ans=0;
	sort(inp.begin(),inp.end());
	for(int i=0;i<inp.size();i++){
		for(int j=0;j<i;j++){
			if(inp[i].fi==inp[j].fi){
				if(inp[i].se==inp[j].se){
					ans+=2;
				}
			}
			else{
				string a=inp[i].se;
				string b=inp[j].se;
				//cout << a << " " << b<< " " <<inp[i].fi-inp[j].fi+1<< " "<< ans<<" ";
				for(int k=0;k<inp[i].fi-inp[j].fi+1;k++){
					if(a[k]==b[0]){
						ans++;
						for(int l=0;l<inp[j].fi;l++){
							if(a[k+l]!=b[l]){
								ans--;
								break;
							}
						}
					}
				}
				//cout << ans <<endl;
			}
		}
	}
	cout << ans;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:16:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<inp.size();i++){
              ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Incorrect 16 ms 384 KB Output isn't correct
6 Incorrect 31 ms 384 KB Output isn't correct
7 Incorrect 51 ms 512 KB Output isn't correct
8 Correct 43 ms 512 KB Output is correct
9 Execution timed out 1080 ms 1084 KB Time limit exceeded
10 Execution timed out 1004 ms 1084 KB Time limit exceeded
11 Execution timed out 1080 ms 1084 KB Time limit exceeded
12 Execution timed out 1075 ms 1084 KB Time limit exceeded
13 Execution timed out 1083 ms 1784 KB Time limit exceeded
14 Execution timed out 1066 ms 1784 KB Time limit exceeded
15 Execution timed out 1080 ms 1784 KB Time limit exceeded
16 Execution timed out 1077 ms 1784 KB Time limit exceeded
17 Execution timed out 1060 ms 1784 KB Time limit exceeded
18 Execution timed out 1082 ms 1784 KB Time limit exceeded
19 Execution timed out 1070 ms 1784 KB Time limit exceeded
20 Execution timed out 1087 ms 1784 KB Time limit exceeded