結果

問題 No.755 Zero-Sum Rectangle
ユーザー 👑 tatyam
提出日時 2018-11-15 16:46:42
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 539 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 69,220 KB
最終ジャッジ日時 2025-01-06 16:41:42
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 7 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
    int n,m;
    cin >> n >> m;
    ll a[m+1][m+1];
    rep(i,1,m+1) rep(j,1,m+1) cin >> a[i][j];
    rep(i,1,m+1) rep(j,1,m+1) a[i][j] += a[i][j-1];
    rep(j,1,m+1) rep(i,1,m+1) a[i][j] += a[i-1][j];
    rep(i,0,n) {
        int x,y;
        cin >> x >> y;
        int ans = 0;
        rep(i,0,x) rep(j,0,y) rep(k,x,m+1) rep(l,y,m+1) if(a[i][j] - a[i][l] - a[k][j] + a[k][l] == 0) ans++;
        cout << ans << endl;
    }
}
0