結果
| 問題 |
No.2250 Split Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-22 04:40:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 127 ms / 3,000 ms |
| コード長 | 602 bytes |
| コンパイル時間 | 3,774 ms |
| コンパイル使用メモリ | 231,576 KB |
| 実行使用メモリ | 9,076 KB |
| 最終ジャッジ日時 | 2024-09-18 14:42:11 |
| 合計ジャッジ時間 | 6,660 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
mint e() { return mint(0); }
mint op(mint a, mint b) { return a + b; }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
vector<int> p(n);
segtree<mint, op, e> prb(n), sum(n);
mint pw = 1, ans = 0;
for (int i = 0; i < n; i++) {
int u; cin >> u; u--;
ans -= prb.prod(u, n) / pw;
ans += sum.prod(u, n);
prb.set(u, pw); sum.set(u, 1); pw *= 2;
}
cout << (ans * pw / 2).val();
}