結果

問題 No.1338 Giant Class
ユーザー kobakoba_issakobakoba_issa
提出日時 2021-01-30 00:53:36
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 1,056 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 9,696 KB
最終ジャッジ日時 2023-09-09 18:17:36
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 197 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 164 ms
7,380 KB
testcase_07 AC 233 ms
9,136 KB
testcase_08 AC 149 ms
7,024 KB
testcase_09 AC 139 ms
6,808 KB
testcase_10 AC 260 ms
9,504 KB
testcase_11 AC 24 ms
4,384 KB
testcase_12 AC 177 ms
6,548 KB
testcase_13 AC 159 ms
7,024 KB
testcase_14 AC 40 ms
4,420 KB
testcase_15 AC 60 ms
4,880 KB
testcase_16 AC 21 ms
4,380 KB
testcase_17 AC 154 ms
7,036 KB
testcase_18 AC 40 ms
4,384 KB
testcase_19 AC 72 ms
5,096 KB
testcase_20 AC 290 ms
9,696 KB
testcase_21 AC 294 ms
9,668 KB
testcase_22 AC 281 ms
9,692 KB
権限があれば一括ダウンロードができます

ソースコード

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