답안 #116877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116877 2019-06-14T03:15:45 Z TienDungz Lozinke (COCI17_lozinke) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int res=0,n,fact[300005];
string t;
vector<string> adj;
map<string,int> cnt;
map<string,bool> cur[300005];
bool cmp (string a,string b)
{
	return a.length()<b.length();
}
signed main()
{
	cin>>n;
	fact[0]=1;
	for(int i=1;i<=200005;i++)
	fact[i]=fact[i-1]*i;
	for(int i=1;i<=n;i++)
	{
		cin>>t;
		adj.push_back(t);
	}
	sort(adj.begin(),adj.end(),cmp);
	adj.push_back("b");
	for(int i=0;i<n;i++)
	{
		for(int k=1;k<=adj[i].length()-1;k++)
		{
			string s[200005];
			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())
		{
			res+=fact[cnt[adj[i]]]/fact[cnt[adj[i]]-2];
		}
	}
	cout<<res;
}

Compilation message

lozinke.cpp: In function 'int main()':
lozinke.cpp:28:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int k=1;k<=adj[i].length()-1;k++)
               ~^~~~~~~~~~~~~~~~~~~
lozinke.cpp:31:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int j=0;j<=(adj[i].length()-1)-k+1;j++)
                ~^~~~~~~~~~~~~~~~~~~~~~~~~
lozinke.cpp:38:6: error: 'ditme' was not declared in this scope
      ditme.push_back(s[j]);
      ^~~~~
lozinke.cpp:38:6: note: suggested alternative: 'time'
      ditme.push_back(s[j]);
      ^~~~~
      time