結果

問題 No.1338 Giant Class
ユーザー kobakoba_issa
提出日時 2021-01-30 00:53:36
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 1,448 ms
コンパイル使用メモリ 143,540 KB
実行使用メモリ 9,728 KB
最終ジャッジ日時 2024-06-27 10:53:42
合計ジャッジ時間 6,181 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>
#include <ctype.h>

using namespace std;

typedef long long ll;

const int INF = (1<<30)-1;
const ll LINF = 1e18;

#define rep(i, n) for (int i = 0; i < n; i++)

template<class T> 
bool chmax(T &a, T b) {if (a < b) {a = b;return true;}else return false;}

template<class T> 
bool chmin(T &a, T b) {if (a > b) {a = b;return true;}else return false;}

int main() {
    ll h, w, q; cin >> h >> w >> q;
    map<ll,ll> mp;
    ll ans = h*w;
    while (q--) {
        ll y, x;    cin >> y >> x;
        if (mp.count(x) == 0) {
            ans -= h - y + 1;
            mp[x] = y;
        }
        else if (mp[x] > y){
            ans -= mp[x] - y;
            mp[x] = y;
        }
        cout << ans << endl;
    }
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;
0