Submission #8352190


Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int mod_pow(Int x, Int a, Int m = MOD){
    if(a == 0)return 1;
    Int res = mod_pow(x, a / 2, m);
    res = res * res % m;
    if(a % 2)res *= x;
    return res % m;
}

Int inv(Int x, Int m = MOD){
    return mod_pow(x, m-2, m);
}
Int n, d;
Int cnt[110000];


int main(){
    cin >> n;
    Int maxd = 0;
    for(int i = 0;i < n;i++){
        cin >> d;
        if(i == 0){
            if(d != 0)cout << 0 << endl;
            return 0;
        }else{
            if(d == 0)cout << 0 << endl;
            return 0;
        }
        cnt[d]++;
        maxd = max(maxd, d);
    }
    Int ans = 1;
    for(int i = 1;i <= maxd;i++){
        ans = ans * mod_pow(cnt[i-1], cnt[i]) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Counting of Trees
User catupper
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1104 Byte
Status WA
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 2
AC × 6
WA × 21
Set Name Test Cases
Sample sample01.txt, sample02.txt, sample03.txt
All sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, sample01.txt, sample02.txt, sample03.txt
Case Name Status Exec Time Memory
in01.txt WA 1 ms 256 KB
in02.txt WA 1 ms 256 KB
in03.txt WA 1 ms 256 KB
in04.txt WA 1 ms 256 KB
in05.txt WA 1 ms 256 KB
in06.txt WA 1 ms 256 KB
in07.txt WA 1 ms 256 KB
in08.txt WA 1 ms 256 KB
in09.txt WA 1 ms 256 KB
in10.txt WA 1 ms 256 KB
in11.txt WA 1 ms 256 KB
in12.txt AC 1 ms 256 KB
in13.txt AC 1 ms 256 KB
in14.txt WA 1 ms 256 KB
in15.txt WA 1 ms 256 KB
in16.txt WA 1 ms 256 KB
in17.txt WA 1 ms 256 KB
in18.txt WA 1 ms 256 KB
in19.txt WA 1 ms 256 KB
in20.txt AC 1 ms 256 KB
in21.txt AC 1 ms 256 KB
sample01.txt WA 1 ms 256 KB
sample02.txt AC 1 ms 256 KB
sample03.txt WA 1 ms 256 KB