結果
| 問題 | No.755 Zero-Sum Rectangle | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-12-03 05:56:24 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 205 ms / 2,000 ms | 
| コード長 | 524 bytes | 
| コンパイル時間 | 522 ms | 
| コンパイル使用メモリ | 66,332 KB | 
| 実行使用メモリ | 13,760 KB | 
| 最終ジャッジ日時 | 2024-07-01 05:35:10 | 
| 合計ジャッジ時間 | 5,699 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 11 TLE * 1 | 
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main()
      | ^~~~
            
            ソースコード
#include<iostream>
using namespace std;
int n,m;
long a[130][130],s[131][131];
main()
{
	cin>>n>>m;
	for(int i=0;i<m;i++)for(int j=0;j<m;j++)cin>>a[i][j];
	for(int i=0;i<m;i++)for(int j=0;j<m;j++)s[i+1][j+1]=s[i+1][j]+a[i][j];
	for(int j=0;j<=m;j++)for(int i=0;i<m;i++)s[i+1][j]+=s[i][j];
	for(int c=0;c<n;c++)
	{
		int x,y;cin>>x>>y;
		int ans=0;
		for(int i=0;i<x;i++)for(int j=x;j<=m;j++)
		{
			for(int k=0;k<y;k++)for(int l=y;l<=m;l++)
			{
				ans+=s[j][l]+s[i][k]-s[j][k]-s[i][l]==0;
			}
		}
		cout<<ans<<endl;
	}
}
            
            
            
        