답안 #116866

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116866 2019-06-14T03:02:06 Z TienDungz Lozinke (COCI17_lozinke) C++14
0 / 100
357 ms 44632 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int res=0,n;
string t;
vector<string> adj,ditme;
map<string,int> cnt;
map<string,bool> cur[200005];
bool cmp (string a,string b)
{
	return a.length()<b.length();
}
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>t;
		adj.push_back(t);
	}
	sort(adj.begin(),adj.end(),cmp);
	for(int i=0;i<n;i++)
	{
		for(int k=1;k<=adj[i].length()-1;k++)
		{
			string s[20];
			for(int j=0;j<=(adj[i].length()-1)-k+1;j++)
			{
				s[j]=adj[i].substr(j,k);
				if(cnt[s[j]]>=1&&cur[i][s[j]]==false) 
				{
					res+=cnt[s[j]];
					cur[i][s[j]]=true;
					ditme.push_back(s[j]);
				}
			}
		}
		cnt[adj[i]]++;
		if(cnt[adj[i]]>=2&&(adj[i+1].length()>adj[i].length()||i==n-1))
		{
			int temp=1;
			for(int j=1;j<=cnt[adj[i]];j++)
			{
				temp=temp*j;	
			}
			res+=temp;
		}
	}
	cout<<res;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:24:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int k=1;k<=adj[i].length()-1;k++)
               ~^~~~~~~~~~~~~~~~~~~
lozinke.cpp:27:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=0;j<=(adj[i].length()-1)-k+1;j++)
                ~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 9728 KB Output isn't correct
2 Incorrect 11 ms 9728 KB Output isn't correct
3 Incorrect 11 ms 9856 KB Output isn't correct
4 Incorrect 11 ms 9984 KB Output isn't correct
5 Incorrect 19 ms 11256 KB Output isn't correct
6 Incorrect 23 ms 11252 KB Output isn't correct
7 Incorrect 32 ms 12912 KB Output isn't correct
8 Incorrect 33 ms 11640 KB Output isn't correct
9 Incorrect 143 ms 30052 KB Output isn't correct
10 Incorrect 152 ms 16876 KB Output isn't correct
11 Incorrect 230 ms 36528 KB Output isn't correct
12 Incorrect 357 ms 25968 KB Output isn't correct
13 Incorrect 221 ms 22716 KB Output isn't correct
14 Incorrect 351 ms 44632 KB Output isn't correct
15 Incorrect 354 ms 25768 KB Output isn't correct
16 Incorrect 145 ms 12908 KB Output isn't correct
17 Incorrect 77 ms 10872 KB Output isn't correct
18 Incorrect 75 ms 15088 KB Output isn't correct
19 Incorrect 292 ms 27052 KB Output isn't correct
20 Incorrect 212 ms 37720 KB Output isn't correct