結果
| 問題 | No.3530 「」 |
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2026-05-04 23:36:02 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 3,000 ms |
| コード長 | 1,690 bytes |
| 記録 | |
| コンパイル時間 | 2,784 ms |
| コンパイル使用メモリ | 364,840 KB |
| 実行使用メモリ | 8,860 KB |
| 最終ジャッジ日時 | 2026-05-04 23:36:11 |
| 合計ジャッジ時間 | 5,145 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 |
ソースコード
#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic warning "-Wunused-function"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using mint = modint998244353;
struct S {
mint v00, v01, v11;
};
S op(S x, S y) {
return S{
x.v00 * y.v00,
x.v01 * y.v11 + x.v00 * y.v01,
x.v11 * y.v11};
}
S e() { return S{1, 0, 1}; }
} int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<P> xy(n);
for (auto& [x, y] : xy) cin >> x >> y;
S up{3, 1, 4}, down{4, 0, 3};
mint ans;
rep(_, 2) {
for (auto& [x, y] : xy) swap(x, y);
sort(all(xy));
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int i, int j) {
return xy[i].second < xy[j].second;
});
segtree<S, op, e> seg(vector<S>(n, up));
int pre = xy[ord[0]].second;
mint tot = mint(4).pow(n);
for (int i : ord) {
auto [x, y] = xy[i];
auto s = seg.all_prod();
ans += (tot - (s.v00 + s.v01)) * (y - pre);
seg.set(i, down);
pre = y;
}
}
ans *= 2;
cout << ans.val() << '\n';
}
Kude