結果

問題 No.755 Zero-Sum Rectangle
ユーザー 👑 tatyamtatyam
提出日時 2018-11-15 17:14:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 71,288 KB
実行使用メモリ 7,564 KB
最終ジャッジ日時 2023-09-13 20:41:15
合計ジャッジ時間 5,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,564 KB
testcase_01 AC 90 ms
4,380 KB
testcase_02 AC 72 ms
4,376 KB
testcase_03 AC 96 ms
4,380 KB
testcase_04 AC 109 ms
4,380 KB
testcase_05 AC 120 ms
4,380 KB
testcase_06 AC 80 ms
4,380 KB
testcase_07 AC 74 ms
4,380 KB
testcase_08 AC 101 ms
4,376 KB
testcase_09 AC 112 ms
4,380 KB
testcase_10 AC 130 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
evil_1 TLE -
権限があれば一括ダウンロードができます

ソースコード

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,0,m+1) a[0][i] = a[i][0] = 0;
    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