답안 #198633

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
198633 2020-01-27T05:44:23 Z arnold518 Cubeword (CEOI19_cubeword) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 1e5;
const int S = 6;
const ll MOD = 998244353;

int N;
ll ans, cnt[70][70], D[70][70][70];
vector<string> S, T[15];

int convert(char s)
{
	if('a'<=s && s<='z') return s-'a';
	if('A'<=s && s<='Z') return s-'A'+26;
	if('0'<=s && s<='9') return s-'0'+52;
}

int main()
{
	int i, j, p, q, k;

	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL); cout.tie(NULL);
	cin>>N;
	for(i=1; i<=N; i++)
	{
		string s, t;
		cin>>s; t=s;
		reverse(t.begin(), t.end());
		S.push_back(s);
		S.push_back(t);
	}

	sort(S.begin(), S.end());
	S.erase(unique(S.begin(), S.end()), S.end());

	for(i=0; i<S.size(); i++) T[S[i].size()].push_back(S[i]);

	for(k=3; k<=10; k++)
	{
		vector<string> V=T[k];
		if(V.empty()) continue;

		memset(cnt, 0, sizeof(cnt));
		memset(D, 0, sizeof(D));
		for(i=0; i<V.size(); i++) cnt[convert(V[i][0])][convert(V[i][V[i].size()-1])]++;

		for(i=0; i<S; i++) for(j=0; j<S; j++) for(p=0; p<S; p++)
		{
			for(q=0; q<S; q++)
			{
				D[i][j][p]+=cnt[i][q]*cnt[j][q]%MOD*cnt[p][q]%MOD;
				D[i][j][p]%=MOD;
			}
		}

		for(i=0; i<S; i++) for(j=0; j<S; j++) for(p=0; p<S; p++) for(q=0; q<S; q++)
		{
			ans+=D[i][j][p]*D[i][j][q]%MOD*D[i][p][q]%MOD*D[j][p][q]%MOD;
			ans%=MOD;
		}
	}
	cout<<ans;
}

Compilation message

cubeword.cpp:14:16: error: conflicting declaration 'std::vector<std::__cxx11::basic_string<char> > S'
 vector<string> S, T[15];
                ^
cubeword.cpp:9:11: note: previous declaration as 'const int S'
 const int S = 6;
           ^
cubeword.cpp: In function 'int main()':
cubeword.cpp:35:5: error: request for member 'push_back' in 'S', which is of non-class type 'const int'
   S.push_back(s);
     ^~~~~~~~~
cubeword.cpp:36:5: error: request for member 'push_back' in 'S', which is of non-class type 'const int'
   S.push_back(t);
     ^~~~~~~~~
cubeword.cpp:39:9: error: request for member 'begin' in 'S', which is of non-class type 'const int'
  sort(S.begin(), S.end());
         ^~~~~
cubeword.cpp:39:20: error: request for member 'end' in 'S', which is of non-class type 'const int'
  sort(S.begin(), S.end());
                    ^~~
cubeword.cpp:40:4: error: request for member 'erase' in 'S', which is of non-class type 'const int'
  S.erase(unique(S.begin(), S.end()), S.end());
    ^~~~~
cubeword.cpp:40:19: error: request for member 'begin' in 'S', which is of non-class type 'const int'
  S.erase(unique(S.begin(), S.end()), S.end());
                   ^~~~~
cubeword.cpp:40:30: error: request for member 'end' in 'S', which is of non-class type 'const int'
  S.erase(unique(S.begin(), S.end()), S.end());
                              ^~~
cubeword.cpp:40:40: error: request for member 'end' in 'S', which is of non-class type 'const int'
  S.erase(unique(S.begin(), S.end()), S.end());
                                        ^~~
cubeword.cpp:42:15: error: request for member 'size' in 'S', which is of non-class type 'const int'
  for(i=0; i<S.size(); i++) T[S[i].size()].push_back(S[i]);
               ^~~~
cubeword.cpp:42:33: error: invalid types 'const int[int]' for array subscript
  for(i=0; i<S.size(); i++) T[S[i].size()].push_back(S[i]);
                                 ^
cubeword.cpp:42:56: error: invalid types 'const int[int]' for array subscript
  for(i=0; i<S.size(); i++) T[S[i].size()].push_back(S[i]);
                                                        ^
cubeword.cpp:51:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=0; i<V.size(); i++) cnt[convert(V[i][0])][convert(V[i][V[i].size()-1])]++;
            ~^~~~~~~~~
cubeword.cpp: In function 'int convert(char)':
cubeword.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^