結果

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

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h,w,n;
    cin>>h>>w>>n;
    vector<vector<int>>imos(h+1,vector<int>(w+1,0));
    while(n--){
        int r1,r2,c1,c2;
        cin>>r1>>c1>>r2>>c2;
        imos[r1-1][c1-1]++;
        imos[r1-1][c2]--;
        imos[r2][c1-1]--;
        imos[r2][c2]++;
    }
    for(int i=0;i<h+1;i++){
        for(int j=0;j<w;j++){
            imos[i][j+1]+=imos[i][j];
        }
    }
    for(int i=0;i<w+1;i++){
        for(int j=0;j<h;j++){
            imos[j+1][i]+=imos[j][i];
        }
    }
    int ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            ans+=(!(bool)(imos[i][j]));
        }
    }
    cout<<ans<<endl;
    return 0;
}
0