結果
問題 | No.755 Zero-Sum Rectangle |
ユーザー |
![]() |
提出日時 | 2018-12-03 00:06:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 159 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 783 ms |
コンパイル使用メモリ | 94,024 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-07-01 05:29:18 |
合計ジャッジ時間 | 5,670 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 TLE * 1 |
ソースコード
#include <cstdio>#include <cstring>#include <string>#include <iostream>#include <cmath>#include <bitset>#include <vector>#include <map>#include <set>#include <queue>#include <deque>#include <algorithm>#include <unordered_map>#include <unordered_set>#include <random>using namespace std;typedef long long int ll;typedef pair<int, int> P;int main(){int n, m;cin>>n>>m;ll a[131][131], s[131][131]={};for(int i=1; i<=m; i++){for(int j=1; j<=m; j++){cin>>a[i][j];s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1]+a[i][j];}}for(int i=0; i<n; i++){int x, y;cin>>x>>y;int ans=0;for(int a=1; a<=x; a++){for(int b=x; b<=m; b++){for(int c=1; c<=y; c++){for(int d=y; d<=m; d++){if(s[b][d]-s[a-1][d]-s[b][c-1]+s[a-1][c-1]==0) ans++;}}}}cout<<ans<<endl;}return 0;}