Submission #66942426


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = atcoder::static_modint<998244353>;
// using mint = atcoder::static_modint<1000000007>;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<(int)n; i++)
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};

mint op(mint x,mint y){return x*y;}
mint e(){return 1;}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin >> n;
    vector<vector<int>> a(n,vector<int>(6));
    vector<vector<int>> p(n*6);
    rep(i,0,n){
        rep(j,0,6)cin >> a[i][j];
        sort(a[i].begin(),a[i].end());
        rep(j,0,6)p[i*6+j]={a[i][j],i,j};
    }
    sort(p.begin(),p.end());
    segtree<mint,op,e> seg(n);
    mint ans=0;
    rep(i,0,n)seg.set(i,0);
    for(auto v:p){
        int x=v[0],i=v[1],j=v[2];
        seg.set(i,1);
        ans+=seg.all_prod()*x;
        // cout << x << " " << i << " " << j << " " << seg.all_prod().val() << "\n";
        seg.set(i,j+1);
    }
    ans/=mint(6).pow(n);
    cout << ans.val();
}

Submission Info

Submission Time
Task E - E [max]
User makichan
Language C++ 23 (gcc 12.2)
Score 450
Code Size 1238 Byte
Status AC
Exec Time 269 ms
Memory 43084 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 450 / 450
Status
AC × 3
AC × 26
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 02_random2_04.txt, 02_random2_05.txt, 02_random2_06.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt, 03_handmade_05.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3552 KiB
00_sample_01.txt AC 1 ms 3488 KiB
00_sample_02.txt AC 1 ms 3540 KiB
01_random_00.txt AC 20 ms 7088 KiB
01_random_01.txt AC 257 ms 42672 KiB
01_random_02.txt AC 140 ms 26384 KiB
01_random_03.txt AC 255 ms 43084 KiB
01_random_04.txt AC 3 ms 3780 KiB
01_random_05.txt AC 256 ms 42596 KiB
01_random_06.txt AC 126 ms 24116 KiB
01_random_07.txt AC 255 ms 42596 KiB
01_random_08.txt AC 219 ms 37684 KiB
01_random_09.txt AC 255 ms 42820 KiB
02_random2_00.txt AC 170 ms 42692 KiB
02_random2_01.txt AC 238 ms 42684 KiB
02_random2_02.txt AC 263 ms 42644 KiB
02_random2_03.txt AC 269 ms 42660 KiB
02_random2_04.txt AC 268 ms 42672 KiB
02_random2_05.txt AC 260 ms 42988 KiB
02_random2_06.txt AC 205 ms 42696 KiB
03_handmade_00.txt AC 1 ms 3548 KiB
03_handmade_01.txt AC 1 ms 3532 KiB
03_handmade_02.txt AC 1 ms 3492 KiB
03_handmade_03.txt AC 208 ms 42648 KiB
03_handmade_04.txt AC 205 ms 42712 KiB
03_handmade_05.txt AC 258 ms 42820 KiB