답안 #945695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
945695 2024-03-14T06:28:51 Z Minbaev Cubeword (CEOI19_cubeword) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define all(x) x.begin(),x.end()
#define pb push_back
 
const int N=1e6 + 5	;
const int inf = 1e18 + 7;
const int mod = 998244353;
 
int g[11][33][33][33];
int v[11][33][33];
int ans = 0;
int n,m,k;
 
map<char,int>mps;
 
vector<int>vs;
 
int ii(char ch){
	return mps[ch];	
}
 
void dfs(int i){
	
	
	
}
int cnt = 0;
 
void solve(){
	
	cin >> n;
	map<string,int>mp;
	
	for(int i = 1;i<=n;i++){
		
		string a;
		cin >> a;
		
		if(mp[a] == 0){
			v[a.size()][ii(a[0])][ii(a[a.size()-1])] += 1;
		}
		mp[a] += 1;
		reverse(all(a));
		
		if(mp[a] == 0){
			v[a.size()][ii(a[0])][ii(a[a.size()-1])] += 1;
		}
		mp[a] += 1;
	}
	for(int sz = 3;sz<=10;sz++){
		for(int i = 0;i<cnt;i++){
			for(int j = 0;j<cnt;j++){
				for(int l = 0;l<cnt;l++){
					for(int u = 0;u<cnt;u++){
						g[j][l][u] += ((v[i][j]*v[i][l]) % mod) * (v[i][u])% mod;
						g[j][l][u] %= mod;
					}
				}
			}
		}
	}
	
	for(int sz = 3;sz<=10;sz++){
		for(int i = 0;i<cnt;i++){
			for(int j = 0;j<cnt;j++){
				for(int l = 0;l<cnt;l++){
					for(int u = 0;u<cnt;u++){
						ans += (((g[i][j][l] * g[i][j][u])% mod)  * g[i][l][u]) % mod * g[j][l][u] % mod;
						ans %= mod;
					}
				}
			}
		}
	}
	
	cout << ans << '\n';
	
}
/*
 
*/
signed main()
{
	for(int i = 0;i<='p'-'a';i+=1){
		mps['a'+i] = cnt++;
	}
	for(int i = 0;i<='p'-'a';i+=1){
		mps['A'+i] = cnt++;
	}
	
	
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int tt=1;//cin>>tt>>n;
	while(tt--)solve();
 
}

Compilation message

cubeword.cpp: In function 'void solve()':
cubeword.cpp:59:30: error: invalid operands of types 'long long int [33]' and 'long long int [33]' to binary 'operator*'
   59 |       g[j][l][u] += ((v[i][j]*v[i][l]) % mod) * (v[i][u])% mod;
      |                       ~~~~~~~^~~~~~~~
      |                             |       |
      |                             |       long long int [33]
      |                             long long int [33]
cubeword.cpp:60:18: error: invalid operands of types 'long long int [33]' and 'long long int' to binary 'operator%'
   60 |       g[j][l][u] %= mod;
      |       ~~~~~~~~~~~^~~~~~
cubeword.cpp:60:18: note:   in evaluation of 'operator%=(long long int [33], long long int)'
cubeword.cpp:72:28: error: invalid operands of types 'long long int [33]' and 'long long int [33]' to binary 'operator*'
   72 |       ans += (((g[i][j][l] * g[i][j][u])% mod)  * g[i][l][u]) % mod * g[j][l][u] % mod;
      |                 ~~~~~~~~~~ ^ ~~~~~~~~~~
      |                          |            |
      |                          |            long long int [33]
      |                          long long int [33]