답안 #878432

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878432 2023-11-24T11:08:39 Z Trisanu_Das Cubeword (CEOI19_cubeword) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define int long
 
const int B = 62, LIM = 8, M = 998244353;
 
int get(char c) {
	if(c < 60) return c - 48;
	return c - (c < 95 ? 55 : 61);
}
 
int n, a[LIM][B][B], b[LIM][B][B][B], res;
map<string, bool> inp;
int i, j, k, l, x;
 
#define c(i, j, k, l) ((b[L][i][j][l] * b[L][j][k][l]) % M)
signed main() {
	cin >> n;
	while(n--) {
		string s; cin >> s;
		i = size(s);
		if(inp[s]) continue;
		string t = s;
		reverse(begin(t), end(t));
		inp[s] = inp[t] = 1;
		int z = get(s[0]), y = get(end(s)[-1]);
		++a[i-3][z][y];
		if(s != t) ++a[i-3][y][z];
	}
	for(int L = 0; L < LIM; L++) {
		for(int i = 0; i < B; i++) for(int j = 0; j < B; j++) for(int k = 0; k < B; k++) for(int x = 0; x < b; x++) b[L][i][j][k] += a[L][i][x] * a[L][j][x] * a[L][k][x];
		for(int i = 0; i < B; i++) for(int j = 0; j < B; j++) for(int k = 0; k < B; k++) b[L][i][j][k] %= M;
		for(int i = 0; i < B; i++) for(int j = 0; j < B; j++) for(int k = 0; k < B; k++) for(int l = 0; l < B; l++) res += (c(i, j, k, l) * c(l, k, j, i)) % M;
	}
	cout << res % M;
}

Compilation message

cubeword.cpp: In function 'int main()':
cubeword.cpp:31:101: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   31 |   for(int i = 0; i < B; i++) for(int j = 0; j < B; j++) for(int k = 0; k < B; k++) for(int x = 0; x < b; x++) b[L][i][j][k] += a[L][i][x] * a[L][j][x] * a[L][k][x];
      |                                                                                                   ~~^~~