Submission #541237

# Submission time Handle Problem Language Result Execution time Memory
541237 2022-03-22T20:01:12 Z Deepesson Cubeword (CEOI19_cubeword) C++17
21 / 100
677 ms 10652 KB
#include <bits/stdc++.h>
#define MAX 105000
std::vector<std::string> words[MAX];
int N;
const long long MOD = 998244353;
long long tabela[300][300];
void iniciar(int x){
    std::map<std::string,bool> mapa;
    memset(&tabela[0][0],0,sizeof(tabela));
    for(auto&z:words[x]){
        mapa[z]=true;
        std::reverse(z.begin(),z.end());
        mapa[z]=true;
    }
    for(auto&x:mapa){
        tabela[x.first[0]-'a'][x.first.back()-'a']++;
    }
}
long long solve(void){
    long long ans=0;
    for(int a=0;a!=6;++a){
        for(int b=0;b!=6;++b){
            for(int c=0;c!=6;++c){
                for(int d=0;d!=6;++d){
                    for(int e=0;e!=6;++e){
                        for(int f=0;f!=6;++f){
                            for(int g=0;g!=6;++g){
                                for(int h=0;h!=6;++h){
                                    long long vals[]={
                                        tabela[a][b],
                                        tabela[a][c],
                                        tabela[c][d],
                                        tabela[d][b],

                                        tabela[a][f],
                                        tabela[b][e],
                                        tabela[d][h],
                                        tabela[c][g],

                                        tabela[f][g],
                                        tabela[g][h],
                                        tabela[h][e],
                                        tabela[f][e]
                                    };
                                    long long loc=1;
                                    for(auto&x:vals)loc=(loc*x)%MOD;
                                    ans=(ans+loc)%MOD;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return ans;

}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    std::cin>>N;
    for(int i=0;i!=N;++i){
        std::string k;
        std::cin>>k;
        words[k.size()].push_back(k);
    }
    long long tot = 0;
    for(int i=3;i!=11;++i){
        iniciar(i);
        tot = (tot+solve())%MOD;
    }
    std::cout<<tot<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 630 ms 9572 KB Output is correct
2 Correct 639 ms 10504 KB Output is correct
3 Correct 632 ms 10488 KB Output is correct
4 Correct 677 ms 10576 KB Output is correct
5 Correct 633 ms 10576 KB Output is correct
6 Correct 641 ms 10472 KB Output is correct
7 Correct 633 ms 10624 KB Output is correct
8 Correct 641 ms 10496 KB Output is correct
9 Correct 644 ms 10608 KB Output is correct
10 Correct 677 ms 10480 KB Output is correct
11 Correct 649 ms 10568 KB Output is correct
12 Correct 633 ms 10520 KB Output is correct
13 Correct 643 ms 10532 KB Output is correct
14 Correct 643 ms 10652 KB Output is correct
15 Correct 644 ms 10548 KB Output is correct
16 Correct 672 ms 10476 KB Output is correct
17 Correct 664 ms 10516 KB Output is correct
18 Correct 647 ms 10572 KB Output is correct
19 Correct 642 ms 10528 KB Output is correct
20 Correct 644 ms 10588 KB Output is correct
21 Correct 651 ms 10488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 630 ms 9572 KB Output is correct
2 Correct 639 ms 10504 KB Output is correct
3 Correct 632 ms 10488 KB Output is correct
4 Correct 677 ms 10576 KB Output is correct
5 Correct 633 ms 10576 KB Output is correct
6 Correct 641 ms 10472 KB Output is correct
7 Correct 633 ms 10624 KB Output is correct
8 Correct 641 ms 10496 KB Output is correct
9 Correct 644 ms 10608 KB Output is correct
10 Correct 677 ms 10480 KB Output is correct
11 Correct 649 ms 10568 KB Output is correct
12 Correct 633 ms 10520 KB Output is correct
13 Correct 643 ms 10532 KB Output is correct
14 Correct 643 ms 10652 KB Output is correct
15 Correct 644 ms 10548 KB Output is correct
16 Correct 672 ms 10476 KB Output is correct
17 Correct 664 ms 10516 KB Output is correct
18 Correct 647 ms 10572 KB Output is correct
19 Correct 642 ms 10528 KB Output is correct
20 Correct 644 ms 10588 KB Output is correct
21 Correct 651 ms 10488 KB Output is correct
22 Incorrect 661 ms 9632 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 630 ms 9572 KB Output is correct
2 Correct 639 ms 10504 KB Output is correct
3 Correct 632 ms 10488 KB Output is correct
4 Correct 677 ms 10576 KB Output is correct
5 Correct 633 ms 10576 KB Output is correct
6 Correct 641 ms 10472 KB Output is correct
7 Correct 633 ms 10624 KB Output is correct
8 Correct 641 ms 10496 KB Output is correct
9 Correct 644 ms 10608 KB Output is correct
10 Correct 677 ms 10480 KB Output is correct
11 Correct 649 ms 10568 KB Output is correct
12 Correct 633 ms 10520 KB Output is correct
13 Correct 643 ms 10532 KB Output is correct
14 Correct 643 ms 10652 KB Output is correct
15 Correct 644 ms 10548 KB Output is correct
16 Correct 672 ms 10476 KB Output is correct
17 Correct 664 ms 10516 KB Output is correct
18 Correct 647 ms 10572 KB Output is correct
19 Correct 642 ms 10528 KB Output is correct
20 Correct 644 ms 10588 KB Output is correct
21 Correct 651 ms 10488 KB Output is correct
22 Incorrect 661 ms 9632 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 630 ms 9572 KB Output is correct
2 Correct 639 ms 10504 KB Output is correct
3 Correct 632 ms 10488 KB Output is correct
4 Correct 677 ms 10576 KB Output is correct
5 Correct 633 ms 10576 KB Output is correct
6 Correct 641 ms 10472 KB Output is correct
7 Correct 633 ms 10624 KB Output is correct
8 Correct 641 ms 10496 KB Output is correct
9 Correct 644 ms 10608 KB Output is correct
10 Correct 677 ms 10480 KB Output is correct
11 Correct 649 ms 10568 KB Output is correct
12 Correct 633 ms 10520 KB Output is correct
13 Correct 643 ms 10532 KB Output is correct
14 Correct 643 ms 10652 KB Output is correct
15 Correct 644 ms 10548 KB Output is correct
16 Correct 672 ms 10476 KB Output is correct
17 Correct 664 ms 10516 KB Output is correct
18 Correct 647 ms 10572 KB Output is correct
19 Correct 642 ms 10528 KB Output is correct
20 Correct 644 ms 10588 KB Output is correct
21 Correct 651 ms 10488 KB Output is correct
22 Incorrect 661 ms 9632 KB Output isn't correct
23 Halted 0 ms 0 KB -