답안 #145481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145481 2019-08-20T07:24:38 Z Fasho Lozinke (COCI17_lozinke) C++14
0 / 100
1000 ms 31948 KB
#include <bits/stdc++.h>
#define N 20005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
#define INF 1000000000005
using namespace std;

ll n,m,ar[N],sum;

string s[N],tmp;

map<string,ll> mp,mark;

int main()
{
	fast;
	cin>>n;
	fo(i,1,n)
	{
		cin>>s[i];
		mp[s[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<s[i].size();j++)
			for(int h=0;h<=j;h++)
			{
				for(int g=0;g<=j-h;g++)
				{
					tmp.pb(s[i][h+g]);
				}
				if(mark[tmp])
					continue;
				mark[tmp]++;
				if(h==0 && j==s[i].size()-1)
					sum--;
				sum+=mp[tmp];
				// cout<<tmp<<sp;
				tmp.clear();
			}
		for(int j=0;j<s[i].size();j++)
			for(int h=0;h<=j;h++)
			{
				for(int g=0;g<=j-h;g++)
				{
					tmp.pb(s[i][h+g]);
				}
				if(mark[tmp]=0)
					continue;
				tmp.clear();
			}


	}
	cout<<sum;



}



/*     cd onedrive\desktop\kod
cls


*/

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:38:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<s[i].size();j++)
               ~^~~~~~~~~~~~
lozinke.cpp:48:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(h==0 && j==s[i].size()-1)
                ~^~~~~~~~~~~~~~~
lozinke.cpp:54:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<s[i].size();j++)
               ~^~~~~~~~~~~~
lozinke.cpp:61:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     if(mark[tmp]=0)
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1016 KB Output isn't correct
2 Incorrect 3 ms 1016 KB Output isn't correct
3 Incorrect 4 ms 1016 KB Output isn't correct
4 Incorrect 5 ms 1144 KB Output isn't correct
5 Incorrect 26 ms 1960 KB Output isn't correct
6 Incorrect 45 ms 2168 KB Output isn't correct
7 Incorrect 59 ms 3448 KB Output isn't correct
8 Incorrect 98 ms 4972 KB Output isn't correct
9 Incorrect 274 ms 6900 KB Output isn't correct
10 Incorrect 612 ms 16636 KB Output isn't correct
11 Incorrect 448 ms 11164 KB Output isn't correct
12 Execution timed out 1085 ms 31948 KB Time limit exceeded
13 Incorrect 856 ms 13304 KB Output isn't correct
14 Incorrect 981 ms 30328 KB Output isn't correct
15 Execution timed out 1083 ms 31096 KB Time limit exceeded
16 Incorrect 842 ms 12592 KB Output isn't correct
17 Incorrect 195 ms 1272 KB Output isn't correct
18 Incorrect 143 ms 1272 KB Output isn't correct
19 Incorrect 930 ms 20088 KB Output isn't correct
20 Incorrect 378 ms 6136 KB Output isn't correct