結果

問題 No.3709 Unknown Treasure
コンテスト
ユーザー GOTKAKO
提出日時 2026-09-11 21:25:59
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 74 ms / 2,000 ms
+ 874µs
コード長 675 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,192 ms
コンパイル使用メモリ 215,112 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2026-09-11 21:26:22
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int H,W,N; cin >> H >> W >> N;
    vector<vector<int>> S(H+1,vector<int>(W+1));
    while(N--){
        int r1,c1,r2,c2; cin >> r1 >> c1 >> r2 >> c2,r1--,c1--;
        S.at(r1).at(c1)++,S.at(r2).at(c2)++;
        S.at(r1).at(c2)--,S.at(r2).at(c1)--;
    }
    for(int i=0; i<H; i++) for(int k=1; k<W; k++) S.at(i).at(k) += S.at(i).at(k-1);
    for(int i=1; i<H; i++) for(int k=0; k<W; k++) S.at(i).at(k) += S.at(i-1).at(k);
    int answer = 0;
    for(int i=0; i<H; i++) for(int k=0; k<W; k++) answer += S.at(i).at(k)==0;
    cout << answer << endl;
}
0