結果
| 問題 |
No.2683 Two Sheets
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2024-03-20 21:25:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 846 bytes |
| コンパイル時間 | 4,364 ms |
| コンパイル使用メモリ | 252,436 KB |
| 最終ジャッジ日時 | 2025-02-20 08:41:59 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
long long H,W,A,B;
cin>>H>>W>>A>>B;
mint t = A;
t *= B;
t *= H-A+1;
t *= W-B+1;
t *= H-A+1;
t *= W-B+1;
t *= 2;
mint h = 0,w = 0;
rep(_,2){
for(int i=A-1;true;i--){
int x = 0,y = A-1,z = i,w = i+A-1;
int d = max(y,w) - min(x,z) + 1;
if(d >= A*2)break;
mint tt = A*2 - d;
tt *= max(0LL,H - d + 1);
h += tt;
}
swap(h,w);
swap(H,W);
swap(A,B);
}
//cout<<h.val()<<' '<<w.val()<<endl;
t -= h * w;
t /= H-A+1;
t /= W-B+1;
t /= H-A+1;
t /= W-B+1;
cout<<t.val()<<endl;
return 0;
}
沙耶花