結果

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

ソースコード

diff #
raw source code

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

using ld = long double;
using ll = long long;
using ull = unsigned long long;
using VB = vector<bool>;
using VVB = vector<VB>;
using VC = vector<char>;
using VVC = vector<VC>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
using VD = vector<ld>;
using VVD = vector<VD>;
using VT = vector<string>;
using VVT = vector<VT>;
using P = pair<ll, ll>;
using VP = vector<P>;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (ll i = a; i < (ll)(b); i++)
#define ALL(a) (a).begin(),(a).end()

constexpr int INF = 1001001001;
constexpr ll LINF = 1001001001001001001ll;
//constexpr ll LINF = 8e18;
//constexpr int DX[] = {-1, -1, 0, 0, 1, 1};
//constexpr int DY[] = {-1, 0, -1, 1, 0, 1};
constexpr int DX[] = {1, 0, -1, 0, 0, 0};
constexpr int DY[] = {0, 1, 0, -1, 0, 0};
//constexpr int DZ[] = {0, 0, 0,  0, 1, -1};

template< typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true); }
template< typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true); }

using mint = modint998244353;
//using mint = modint1000000007;
using VM = vector<mint>;
using VVM = vector<VM>;
using VVVM = vector<VVM>;
using VVVVM = vector<VVVM>;

inline ll divceil(ll x, ll y) {
    if(x >= 0) return (x + y - 1) / y;
    else return -((-x) / y);
}
inline ll divfloor(ll x, ll y) {
    if(x >= 0) return x / y;
    else return -((- x + y - 1) / y);
}

int main() {
    ios::sync_with_stdio(false); 
    std::cin.tie(nullptr);
    int h, w, n;
    cin >> h >> w >> n;
    VVI d(h + 1, VI(w + 1, 0));
    REP(i, n) {
        int r1, c1, r2, c2;
        cin >> r1 >> c1 >> r2 >> c2;
        r1--;
        c1--;
        d[r1][c1]++;
        d[r1][c2]--;
        d[r2][c1]--;
        d[r2][c2]++;
    }
    REP(i, h + 1) REP(j, w) {
        d[i][j + 1] += d[i][j];
    }
    /*
    REP(i, h + 1) {
        REP(j, w + 1) cout << d[i][j];
        cout << endl;
    }
    */
    REP(j, w + 1) REP(i, h) {
        d[i + 1][j] += d[i][j]; 
    }
    /*
    cout << endl;
    REP(i, h + 1) {
        REP(j, w + 1) cout << d[i][j];
        cout << endl;
    }
    */
    int ans = 0;
    REP(i, h) REP(j, w) {
        if (d[i][j] == 0) ans++;
    }
    cout << ans << endl;
}
0