結果
| 問題 |
No.1141 田グリッド
|
| コンテスト | |
| ユーザー |
harurun
|
| 提出日時 | 2025-10-19 21:32:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 713 bytes |
| コンパイル時間 | 2,990 ms |
| コンパイル使用メモリ | 283,860 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-10-19 21:32:09 |
| 合計ジャッジ時間 | 8,321 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 RE * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#include <atcoder/modint>
using mint=atcoder::modint1000000007;
int main(){
ll H,W;
cin>>H>>W;
vector<vector<ll>> A(H, vector<ll>(W));
mint ans=1;
for(ll i=0;i<H;i++){
for(ll j=0;j<W;j++){
cin>>A[i][j];
ans*=A[i][j];
}
}
vector<mint> X(H,1),Y(W,1);
for(ll i=0;i<H;i++){
for(ll j=0;j<W;j++){
X[i]*=A[i][j];
Y[j]*=A[i][j];
}
}
// cerr<<ans.val()<<endl;
ll Q;
cin>>Q;
for(ll i=0;i<Q;i++){
ll r,c;
cin>>r>>c;
mint a=(mint)(ans/(X[r-1]*Y[c-1])*A[r-1][c-1]);
cout<<a.val()<<endl;
}
}
harurun