結果
問題 | No.755 Zero-Sum Rectangle |
ユーザー | edamame882 |
提出日時 | 2019-07-25 18:34:05 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 852 ms / 2,000 ms |
コード長 | 1,617 bytes |
コンパイル時間 | 1,495 ms |
コンパイル使用メモリ | 166,804 KB |
実行使用メモリ | 7,816 KB |
最終ジャッジ日時 | 2023-09-15 00:03:41 |
合計ジャッジ時間 | 13,539 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,816 KB |
testcase_01 | AC | 777 ms
4,380 KB |
testcase_02 | AC | 738 ms
4,380 KB |
testcase_03 | AC | 791 ms
4,376 KB |
testcase_04 | AC | 833 ms
4,376 KB |
testcase_05 | AC | 827 ms
4,376 KB |
testcase_06 | AC | 748 ms
4,380 KB |
testcase_07 | AC | 707 ms
4,376 KB |
testcase_08 | AC | 808 ms
4,380 KB |
testcase_09 | AC | 797 ms
4,380 KB |
testcase_10 | AC | 852 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,380 KB |
evil_1 | TLE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; //repetition #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) //container util #define all(x) (x).begin(),(x).end() //typedef typedef long long ll; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<ll> VLL; typedef vector<VLL> VVLL; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; //const value //const ll MOD = 1e9 + 7; //const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1}; //const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1}; //conversion inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} ll board[150][150]; ll imos2(int x1, int y1, int x2, int y2){ return board[y1][x1] - board[y1][x2-1] - board[y2-1][x1] + board[y2-1][x2-1]; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; memset(board,0,sizeof(board)); FOR(i,1,m+1)FOR(j,1,m+1) cin >> board[i][j]; rep(i,m+1)rep(j,m+1) board[i][j+1] += board[i][j]; rep(i,m+1)rep(j,m+1) board[j+1][i] += board[j][i]; rep(_,n){ int x , y; cin >> y >> x; ll cnt = 0; FOR(si,1,m+1) FOR(ei,si,m+1) FOR(sj,1,m+1) FOR(ej,sj,m+1){ if(si <= y && y <= ei && sj <= x && x <= ej){ if(imos2(ej ,ei, sj, si) == 0) { cnt++; // cout << si << "," << sj << " " << ei << "," << ej << endl; } } } cout << cnt << endl; } return 0; }