結果

問題 No.1141 田グリッド
ユーザー Fu_LFu_L
提出日時 2021-02-23 00:56:47
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 819 bytes
コンパイル時間 4,164 ms
コンパイル使用メモリ 263,672 KB
実行使用メモリ 4,580 KB
最終ジャッジ日時 2023-10-21 18:49:34
合計ジャッジ時間 9,858 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 101 ms
4,572 KB
testcase_14 AC 100 ms
4,572 KB
testcase_15 AC 101 ms
4,380 KB
testcase_16 AC 99 ms
4,376 KB
testcase_17 AC 100 ms
4,380 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 101 ms
4,380 KB
testcase_22 AC 103 ms
4,380 KB
testcase_23 AC 100 ms
4,380 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<ll,ll> P;
typedef modint1000000007 mint;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
ll h,w;
ll q;
ll r,c;
mint s=1;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>h>>w;
    ll a[h][w];
    mint x[h],y[w];
    rep(i,0,h){
        rep(j,0,w){
            cin>>a[i][j];
            s*=a[i][j];
        }
    }
    rep(i,0,h){
        x[i]=1;
        rep(j,0,w){
            x[i]*=a[i][j];
        }
    }
    rep(i,0,w){
        y[i]=1;
        rep(j,0,h){
            y[i]*=a[j][i];
        }
    }
    cin>>q;
    while(q--){
        cin>>r>>c;
        mint ans=s/x[r-1]/y[c-1]*a[r-1][c-1];
        cout<<ans.val()<<endl;
    }

}
0