結果
| 問題 |
No.1141 田グリッド
|
| コンテスト | |
| ユーザー |
Fu_L
|
| 提出日時 | 2021-02-23 00:56:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 819 bytes |
| コンパイル時間 | 4,338 ms |
| コンパイル使用メモリ | 250,716 KB |
| 最終ジャッジ日時 | 2025-01-19 03:42:15 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 13 |
ソースコード
#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;
}
}
Fu_L