結果

問題 No.2742 Car Flow
ユーザー kenken714kenken714
提出日時 2024-04-13 18:10:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,004 bytes
コンパイル時間 2,104 ms
コンパイル使用メモリ 194,060 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 09:30:27
合計ジャッジ時間 3,813 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 29 ms
5,376 KB
testcase_02 AC 30 ms
5,376 KB
testcase_03 AC 30 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 30 ms
5,376 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 14 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 3 ms
5,376 KB
testcase_16 AC 28 ms
5,376 KB
testcase_17 AC 27 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 WA -
testcase_20 AC 10 ms
5,376 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 23 ms
5,376 KB
testcase_23 AC 26 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 11 ms
5,376 KB
testcase_28 AC 11 ms
5,376 KB
testcase_29 AC 3 ms
5,376 KB
testcase_30 AC 24 ms
5,376 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 13 ms
5,376 KB
testcase_35 WA -
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 10 ms
5,376 KB
testcase_38 AC 24 ms
5,376 KB
testcase_39 AC 5 ms
5,376 KB
testcase_40 AC 1 ms
5,376 KB
testcase_41 WA -
testcase_42 AC 2 ms
5,376 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 2 ms
5,376 KB
testcase_46 AC 2 ms
5,376 KB
testcase_47 WA -
testcase_48 AC 1 ms
5,376 KB
testcase_49 AC 1 ms
5,376 KB
testcase_50 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include "bits/stdc++.h"
    using namespace std;

    #define REP(i, n) for(ll i = 0;i < n;i++)
    #define REPR(i, n) for(ll i = n;i >= 0;i--)
    #define FOR(i, m, n) for(ll i = m;i < n;i++)
    #define FORR(i, m, n) for(ll i = m;i >= n;i--)
    #define REPO(i, n) for(ll i = 1;i <= n;i++)
    #define ll long long
    #define INF (ll)1ll << 60
    #define MINF (-1 * INF)
    #define ALL(n) n.begin(),n.end()
    #define MOD (ll)1000000007
    #define P pair<ll, ll>

    ll mod = 998244353;
    ll powmod(ll a, ll b, ll mod = 1e9+7) {
        a %= mod;
        ll res = 1;
        while (b > 0) {
            if (b % 2 == 1)res = res * a % mod;
            a = a * a % mod;
            b /= 2;
        }
        return res;
    }

    int main(){
        ll n, cnt = 0;
        cin >> n;
        REP(i, n){
            ll a;
            cin >> a;
            if(a)cnt++;
        }
        cout << min(cnt * powmod(n, mod - 2, mod) % mod, (n - cnt) * powmod(n, mod - 2, mod) % mod) << endl;
    }
0