結果
| 問題 | No.3563 No T-Junctions in Kyoto |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-29 20:38:45 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,901 bytes |
| 記録 | |
| コンパイル時間 | 4,012 ms |
| コンパイル使用メモリ | 338,744 KB |
| 実行使用メモリ | 35,584 KB |
| 最終ジャッジ日時 | 2026-05-29 20:38:55 |
| 合計ジャッジ時間 | 7,625 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| 部分点1 | 10 % | AC * 1 WA * 10 |
| 満点 | 90 % | AC * 2 WA * 41 |
| 合計 | 0 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vi>;
using vs = vector<string>;
using vc = vector<char>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
template<class T> using min_pq = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1e9;
const ll LINF = 1e18;
const ll mod=998244353;
const long long MOD =998244353 ;
const int MAX_C = 2000005;
long long fact[MAX_C], inv_fact[MAX_C];
long long power(long long a, long long b, long long m) {
long long res = 1;
a %= m;
while (b > 0) {
if (b & 1) res = res * a % m;
a = a * a % m;
b >>= 1;
}
return res;
}
void init_comb() {
fact[0] = 1;
for (int i = 1; i < MAX_C; i++) fact[i] = fact[i-1] * i % MOD;
inv_fact[MAX_C-1] = power(fact[MAX_C-1], MOD-2, MOD);
for (int i = MAX_C-2; i >= 0; i--) {
inv_fact[i] = inv_fact[i+1] * (i+1) % MOD;
}
}
long long nCk(ll n, int k) {
if (k < 0 || k > n) return 0;
if(n<MAX_C) return fact[n] * inv_fact[k] % MOD * inv_fact[n-k] % MOD;
else{
ll re=1;
for(ll i=0;i<k;i++) re=re*((n-i)%MOD)%MOD;
return re*inv_fact[k]%MOD;
}
}
int main() {
init_comb();
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,m;
cin >> n >> m;
ll ans=0;
vll two(7001,1);
ll want=1;
rep(i,7000){
two[i+1]*=want;
want*=2;
want%=mod;
}
vector<vector<bool>> seen(n+1,vector<bool>(m+1,false));
for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){
ll cnt=two[i+j-2];
ll now=((cnt*(n-i+1))%mod)*((n-j+1)%mod);
if(i==n&&j*2==m){
now/=2;
}
if(i*2==n&&j==m) now/=2;
ans+=now;
ans%=mod;
}
cout << ans << endl;
}