結果

問題 No.1141 田グリッド
ユーザー shiomusubi496shiomusubi496
提出日時 2020-07-31 21:50:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 170,740 KB
実行使用メモリ 6,236 KB
最終ジャッジ日時 2023-09-20 22:54:46
合計ジャッジ時間 6,455 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 4 ms
4,376 KB
testcase_13 AC 148 ms
4,380 KB
testcase_14 AC 157 ms
6,236 KB
testcase_15 AC 146 ms
4,476 KB
testcase_16 AC 145 ms
4,376 KB
testcase_17 AC 145 ms
4,376 KB
testcase_18 AC 145 ms
4,380 KB
testcase_19 AC 147 ms
4,380 KB
testcase_20 AC 145 ms
4,380 KB
testcase_21 AC 148 ms
4,376 KB
testcase_22 AC 150 ms
4,384 KB
testcase_23 AC 149 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int p(int A,int B){
    if(B==0)return 1;
    if(B%2)return p(A,B-1)*A%mod;
    int C=p(A,B/2);
    return C*C%mod;
}
signed main(){
    int H,W,ans=1;
    cin>>H>>W;
    vector<vector<int>> A(H,vector<int>(W));
    vector<int> B(H,1),C(W,1);
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin>>A[i][j];
            ans=ans*A[i][j]%mod;
            B[i]=B[i]*A[i][j]%mod;
            C[j]=C[j]*A[i][j]%mod;
        }
    }
    int Q;
    cin>>Q;
    while(Q--){
        int r,c;
        cin>>r>>c;r--,c--;
        cout<<ans*A[r][c]%mod*p(B[r]*C[c]%mod,mod-2)%mod<<endl;
    }
}
0