結果

問題 No.1683 Robot Guidance
ユーザー otoshigootoshigo
提出日時 2021-09-18 14:42:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,861 bytes
コンパイル時間 5,365 ms
コンパイル使用メモリ 261,552 KB
実行使用メモリ 19,068 KB
最終ジャッジ日時 2023-09-13 01:24:47
合計ジャッジ時間 17,825 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 273 ms
18,580 KB
testcase_01 AC 275 ms
18,476 KB
testcase_02 AC 272 ms
18,692 KB
testcase_03 AC 275 ms
18,372 KB
testcase_04 AC 274 ms
18,508 KB
testcase_05 AC 276 ms
18,768 KB
testcase_06 AC 280 ms
18,436 KB
testcase_07 AC 278 ms
18,776 KB
testcase_08 AC 295 ms
18,612 KB
testcase_09 AC 279 ms
18,504 KB
testcase_10 AC 286 ms
18,552 KB
testcase_11 AC 286 ms
18,756 KB
testcase_12 AC 295 ms
18,836 KB
testcase_13 AC 276 ms
18,448 KB
testcase_14 AC 289 ms
18,776 KB
testcase_15 AC 277 ms
18,692 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 275 ms
18,556 KB
testcase_19 AC 274 ms
18,584 KB
testcase_20 AC 275 ms
18,316 KB
testcase_21 AC 273 ms
18,548 KB
testcase_22 AC 274 ms
18,428 KB
testcase_23 AC 278 ms
18,556 KB
testcase_24 AC 295 ms
18,556 KB
testcase_25 AC 278 ms
18,532 KB
testcase_26 AC 277 ms
18,508 KB
testcase_27 AC 276 ms
18,572 KB
testcase_28 AC 277 ms
18,560 KB
testcase_29 AC 277 ms
18,628 KB
testcase_30 AC 276 ms
18,760 KB
testcase_31 AC 276 ms
18,588 KB
testcase_32 AC 275 ms
18,448 KB
testcase_33 AC 276 ms
18,516 KB
testcase_34 AC 274 ms
18,664 KB
testcase_35 AC 275 ms
18,508 KB
testcase_36 AC 274 ms
18,812 KB
testcase_37 AC 275 ms
18,696 KB
testcase_38 AC 277 ms
18,672 KB
testcase_39 AC 278 ms
18,308 KB
testcase_40 AC 274 ms
18,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;  using vvi = vector<vi>;
using vl = vector<ll>;   using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>;
using vm = vector<mint>; using vvm = vector<vm>;
using vpi = vector<pii>; using vvpi = vector<vpi>;
using vpl = vector<pll>; using vvpl = vector<vpl>;
const int inf = 1 << 30;
const ll INF = 1LL << 60;
#define rep(i,m,n) for (int i = m; i < (int)(n); i++)
#define rrep(i,m,n) for (int i = m; i > (int)(n); i--)

const int MAX = 2000001; //nの最大

vm fac(MAX),finv(MAX);

void set_fac(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    rep(i,2,MAX){
        fac[i] = fac[i-1]*i;
        finv[i] = finv[i-1] * mint(i).inv();
    }
}

mint cmb(int n,int k){
    if (k < 0) return 1;
    return fac[n]*finv[n-k]*finv[k];
}

int main(){
    set_fac();
    int a,b,x,y; cin >> a >> b >> x >> y;
    vi s(4,(b+1)/4-1);
    rep(i,0,(b+1)%4){
        s[i]++;
    }
    //cout << s[0] << s[1] << s[2] << s[3] << endl;
    mint ans = 0;
    rep(i,0,a+1){
        int j = a - i;
        if ((i+x)%2 == 1 || (j+y)%2 == 1) continue;
        //cout << i << " " << j << endl;
        int x0 = (i+x)/2,x2 = (i-x)/2,y1 = (j+y)/2,y3 = (j-y)/2;
        if (x0 < 0 || x2 < 0 || y1 < 0 || y3 < 0) continue;
        if (x0 > 0 && b < 0) continue;
        if (x2 > 0 && b < 2) continue;
        if (y1 > 0 && b < 1) continue;
        if (y3 > 0 && b < 3) continue;
        //cout << x0 << " " << x2 << " " << y1 << " " << y3 << endl;
        ans += cmb(x0+s[0],s[0])*cmb(x2+s[2],s[2])*cmb(y1+s[1],s[1])*cmb(y3+s[3],s[3]);
    }
    cout << ans.val() << endl;
}
0