結果

問題 No.2250 Split Permutation
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-08 22:01:06
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 3,000 ms
コード長 750 bytes
コンパイル時間 6,284 ms
コンパイル使用メモリ 336,716 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 14:09:33
合計ジャッジ時間 10,023 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,812 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,948 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 141 ms
6,944 KB
testcase_19 AC 129 ms
6,944 KB
testcase_20 AC 111 ms
6,940 KB
testcase_21 AC 73 ms
6,944 KB
testcase_22 AC 104 ms
6,944 KB
testcase_23 AC 21 ms
6,944 KB
testcase_24 AC 101 ms
6,944 KB
testcase_25 AC 142 ms
6,940 KB
testcase_26 AC 53 ms
6,944 KB
testcase_27 AC 13 ms
6,940 KB
testcase_28 AC 27 ms
6,940 KB
testcase_29 AC 139 ms
6,944 KB
testcase_30 AC 29 ms
6,944 KB
testcase_31 AC 8 ms
6,940 KB
testcase_32 AC 34 ms
6,940 KB
testcase_33 AC 79 ms
6,940 KB
testcase_34 AC 22 ms
6,940 KB
testcase_35 AC 55 ms
6,944 KB
testcase_36 AC 37 ms
6,944 KB
testcase_37 AC 142 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n;cin>>n; 
  vc<int>v(n); rep(i,n)cin>>v[i]; rep(i,n)v[i]--;
  fenwick_tree<int>fw(n);
  mint t=0;
  rep(i,n){
    t+=fw.sum(v[i],n);
    fw.add(v[i],1);
  }
  fenwick_tree<mint>fwx(n);
  rep(i,n){
    t-=fwx.sum(v[i],n)/mint(2).pow(i);
    fwx.add(v[i],mint(2).pow(i));
  }
  t*=mint(2).pow(n-1);
  cout<<t.val();
}
  
0