답안 #1039414

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1039414 2024-07-30T20:20:19 Z vjudge1 Cubeword (CEOI19_cubeword) C++17
84 / 100
1100 ms 18820 KB
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define rep(a,b,c) for(ll a=b; a<c; a++)
#define rep2(a,b,c,d) for(ll a=b; a<c; a+=d)
#define repr(a,b,c) for(ll a=b-1; a>c-1; a--)
#define repa(a,b) for(const auto &a: b)
#define multicase() int t; cin>>t; while(t--)
#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define valid(c) cout<<(c ? "YES" : "NO")<<endl;
#define valid2(c,a,b) cout<<(c ? a : b)<<endl;
#define ll long long 
#define pq_min(a) priority_queue<a, vector<a>, greater<a>>
#define pq_max(a) priority_queue<a>
#define pb push_back
#define mid ((l+r)>>1)
#define flush endl<<flush;

using namespace std;

const ll mod=998244353;

int main(){
	fastIO();
	int n;
	cin>>n;
	string s;
	set<string> st;
	ll t[11][62][62]{};
	map<char,int> val;
	rep(i,0,26){
		val[i+'a']=i;
		val[i+'A']=i+26;
	}
	rep(i,0,10) val[i+'0']=i+52;
	rep(i,0,n){
		cin>>s;
		st.insert(s);
		reverse(s.begin(),s.end());
		st.insert(s);
	}
	repa(e,st) t[e.size()][val[e[0]]][val[e.back()]]++;
	ll ans=0;
	rep(z,3,11){
		ll C[62][62][62]{};
		rep(i,0,62) rep(j,0,62) rep(k,0,62) rep(l,0,62){
			if(!t[i][l] || !t[k][l] || !t[j][l]) continue;
			C[i][j][k]+=t[z][i][l]*t[z][j][l]%mod*t[z][k][l]%mod;
			C[i][j][k]%=mod;
		}
		rep(i,0,62) rep(j,0,62) rep(k,0,62) rep(l,0,62){
			if(!C[i][j][k] || !C[i][j][l] || !C[i][k][l] || !C[j][k][l]) continue;
			ans+=C[i][j][k]*C[i][j][l]%mod*C[i][k][l]%mod*C[j][k][l]%mod;
			ans%=mod;
		}
	}
	cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 17748 KB Output is correct
2 Correct 631 ms 17812 KB Output is correct
3 Correct 645 ms 17944 KB Output is correct
4 Correct 630 ms 17748 KB Output is correct
5 Correct 620 ms 17744 KB Output is correct
6 Correct 632 ms 17740 KB Output is correct
7 Correct 645 ms 17984 KB Output is correct
8 Correct 634 ms 17744 KB Output is correct
9 Correct 645 ms 17748 KB Output is correct
10 Correct 652 ms 17984 KB Output is correct
11 Correct 652 ms 17748 KB Output is correct
12 Correct 629 ms 17748 KB Output is correct
13 Correct 650 ms 17748 KB Output is correct
14 Correct 625 ms 17748 KB Output is correct
15 Correct 643 ms 17972 KB Output is correct
16 Correct 644 ms 17748 KB Output is correct
17 Correct 613 ms 17744 KB Output is correct
18 Correct 618 ms 17752 KB Output is correct
19 Correct 633 ms 17912 KB Output is correct
20 Correct 628 ms 17904 KB Output is correct
21 Correct 611 ms 17744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 17748 KB Output is correct
2 Correct 631 ms 17812 KB Output is correct
3 Correct 645 ms 17944 KB Output is correct
4 Correct 630 ms 17748 KB Output is correct
5 Correct 620 ms 17744 KB Output is correct
6 Correct 632 ms 17740 KB Output is correct
7 Correct 645 ms 17984 KB Output is correct
8 Correct 634 ms 17744 KB Output is correct
9 Correct 645 ms 17748 KB Output is correct
10 Correct 652 ms 17984 KB Output is correct
11 Correct 652 ms 17748 KB Output is correct
12 Correct 629 ms 17748 KB Output is correct
13 Correct 650 ms 17748 KB Output is correct
14 Correct 625 ms 17748 KB Output is correct
15 Correct 643 ms 17972 KB Output is correct
16 Correct 644 ms 17748 KB Output is correct
17 Correct 613 ms 17744 KB Output is correct
18 Correct 618 ms 17752 KB Output is correct
19 Correct 633 ms 17912 KB Output is correct
20 Correct 628 ms 17904 KB Output is correct
21 Correct 611 ms 17744 KB Output is correct
22 Correct 672 ms 18556 KB Output is correct
23 Correct 649 ms 18516 KB Output is correct
24 Correct 649 ms 18424 KB Output is correct
25 Correct 643 ms 18448 KB Output is correct
26 Correct 629 ms 18464 KB Output is correct
27 Correct 711 ms 18512 KB Output is correct
28 Correct 628 ms 18540 KB Output is correct
29 Correct 666 ms 18772 KB Output is correct
30 Correct 662 ms 18512 KB Output is correct
31 Correct 650 ms 18540 KB Output is correct
32 Correct 615 ms 18760 KB Output is correct
33 Correct 609 ms 18432 KB Output is correct
34 Correct 621 ms 18540 KB Output is correct
35 Correct 610 ms 18516 KB Output is correct
36 Correct 657 ms 18552 KB Output is correct
37 Correct 622 ms 18424 KB Output is correct
38 Correct 647 ms 18544 KB Output is correct
39 Correct 637 ms 18544 KB Output is correct
40 Correct 613 ms 18544 KB Output is correct
41 Correct 610 ms 18516 KB Output is correct
42 Correct 630 ms 18512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 17748 KB Output is correct
2 Correct 631 ms 17812 KB Output is correct
3 Correct 645 ms 17944 KB Output is correct
4 Correct 630 ms 17748 KB Output is correct
5 Correct 620 ms 17744 KB Output is correct
6 Correct 632 ms 17740 KB Output is correct
7 Correct 645 ms 17984 KB Output is correct
8 Correct 634 ms 17744 KB Output is correct
9 Correct 645 ms 17748 KB Output is correct
10 Correct 652 ms 17984 KB Output is correct
11 Correct 652 ms 17748 KB Output is correct
12 Correct 629 ms 17748 KB Output is correct
13 Correct 650 ms 17748 KB Output is correct
14 Correct 625 ms 17748 KB Output is correct
15 Correct 643 ms 17972 KB Output is correct
16 Correct 644 ms 17748 KB Output is correct
17 Correct 613 ms 17744 KB Output is correct
18 Correct 618 ms 17752 KB Output is correct
19 Correct 633 ms 17912 KB Output is correct
20 Correct 628 ms 17904 KB Output is correct
21 Correct 611 ms 17744 KB Output is correct
22 Correct 672 ms 18556 KB Output is correct
23 Correct 649 ms 18516 KB Output is correct
24 Correct 649 ms 18424 KB Output is correct
25 Correct 643 ms 18448 KB Output is correct
26 Correct 629 ms 18464 KB Output is correct
27 Correct 711 ms 18512 KB Output is correct
28 Correct 628 ms 18540 KB Output is correct
29 Correct 666 ms 18772 KB Output is correct
30 Correct 662 ms 18512 KB Output is correct
31 Correct 650 ms 18540 KB Output is correct
32 Correct 615 ms 18760 KB Output is correct
33 Correct 609 ms 18432 KB Output is correct
34 Correct 621 ms 18540 KB Output is correct
35 Correct 610 ms 18516 KB Output is correct
36 Correct 657 ms 18552 KB Output is correct
37 Correct 622 ms 18424 KB Output is correct
38 Correct 647 ms 18544 KB Output is correct
39 Correct 637 ms 18544 KB Output is correct
40 Correct 613 ms 18544 KB Output is correct
41 Correct 610 ms 18516 KB Output is correct
42 Correct 630 ms 18512 KB Output is correct
43 Correct 687 ms 18736 KB Output is correct
44 Correct 683 ms 18512 KB Output is correct
45 Correct 719 ms 18732 KB Output is correct
46 Correct 702 ms 18768 KB Output is correct
47 Correct 694 ms 18508 KB Output is correct
48 Correct 671 ms 18616 KB Output is correct
49 Correct 689 ms 18516 KB Output is correct
50 Correct 674 ms 18512 KB Output is correct
51 Correct 739 ms 18724 KB Output is correct
52 Correct 724 ms 18572 KB Output is correct
53 Correct 700 ms 18820 KB Output is correct
54 Correct 724 ms 18512 KB Output is correct
55 Correct 721 ms 18720 KB Output is correct
56 Correct 687 ms 18512 KB Output is correct
57 Correct 706 ms 18704 KB Output is correct
58 Correct 701 ms 18516 KB Output is correct
59 Correct 707 ms 18504 KB Output is correct
60 Correct 699 ms 18720 KB Output is correct
61 Correct 692 ms 18516 KB Output is correct
62 Correct 688 ms 18544 KB Output is correct
63 Correct 694 ms 18724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 639 ms 17748 KB Output is correct
2 Correct 631 ms 17812 KB Output is correct
3 Correct 645 ms 17944 KB Output is correct
4 Correct 630 ms 17748 KB Output is correct
5 Correct 620 ms 17744 KB Output is correct
6 Correct 632 ms 17740 KB Output is correct
7 Correct 645 ms 17984 KB Output is correct
8 Correct 634 ms 17744 KB Output is correct
9 Correct 645 ms 17748 KB Output is correct
10 Correct 652 ms 17984 KB Output is correct
11 Correct 652 ms 17748 KB Output is correct
12 Correct 629 ms 17748 KB Output is correct
13 Correct 650 ms 17748 KB Output is correct
14 Correct 625 ms 17748 KB Output is correct
15 Correct 643 ms 17972 KB Output is correct
16 Correct 644 ms 17748 KB Output is correct
17 Correct 613 ms 17744 KB Output is correct
18 Correct 618 ms 17752 KB Output is correct
19 Correct 633 ms 17912 KB Output is correct
20 Correct 628 ms 17904 KB Output is correct
21 Correct 611 ms 17744 KB Output is correct
22 Correct 672 ms 18556 KB Output is correct
23 Correct 649 ms 18516 KB Output is correct
24 Correct 649 ms 18424 KB Output is correct
25 Correct 643 ms 18448 KB Output is correct
26 Correct 629 ms 18464 KB Output is correct
27 Correct 711 ms 18512 KB Output is correct
28 Correct 628 ms 18540 KB Output is correct
29 Correct 666 ms 18772 KB Output is correct
30 Correct 662 ms 18512 KB Output is correct
31 Correct 650 ms 18540 KB Output is correct
32 Correct 615 ms 18760 KB Output is correct
33 Correct 609 ms 18432 KB Output is correct
34 Correct 621 ms 18540 KB Output is correct
35 Correct 610 ms 18516 KB Output is correct
36 Correct 657 ms 18552 KB Output is correct
37 Correct 622 ms 18424 KB Output is correct
38 Correct 647 ms 18544 KB Output is correct
39 Correct 637 ms 18544 KB Output is correct
40 Correct 613 ms 18544 KB Output is correct
41 Correct 610 ms 18516 KB Output is correct
42 Correct 630 ms 18512 KB Output is correct
43 Correct 687 ms 18736 KB Output is correct
44 Correct 683 ms 18512 KB Output is correct
45 Correct 719 ms 18732 KB Output is correct
46 Correct 702 ms 18768 KB Output is correct
47 Correct 694 ms 18508 KB Output is correct
48 Correct 671 ms 18616 KB Output is correct
49 Correct 689 ms 18516 KB Output is correct
50 Correct 674 ms 18512 KB Output is correct
51 Correct 739 ms 18724 KB Output is correct
52 Correct 724 ms 18572 KB Output is correct
53 Correct 700 ms 18820 KB Output is correct
54 Correct 724 ms 18512 KB Output is correct
55 Correct 721 ms 18720 KB Output is correct
56 Correct 687 ms 18512 KB Output is correct
57 Correct 706 ms 18704 KB Output is correct
58 Correct 701 ms 18516 KB Output is correct
59 Correct 707 ms 18504 KB Output is correct
60 Correct 699 ms 18720 KB Output is correct
61 Correct 692 ms 18516 KB Output is correct
62 Correct 688 ms 18544 KB Output is correct
63 Correct 694 ms 18724 KB Output is correct
64 Execution timed out 1169 ms 18776 KB Time limit exceeded
65 Halted 0 ms 0 KB -