結果

問題 No.1338 Giant Class
ユーザー kappybarkappybar
提出日時 2021-01-15 21:52:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 1,125 bytes
コンパイル時間 1,671 ms
コンパイル使用メモリ 172,332 KB
実行使用メモリ 6,448 KB
最終ジャッジ日時 2023-08-17 16:50:52
合計ジャッジ時間 6,052 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 193 ms
5,400 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 137 ms
4,808 KB
testcase_07 AC 198 ms
5,900 KB
testcase_08 AC 131 ms
4,896 KB
testcase_09 AC 120 ms
4,736 KB
testcase_10 AC 215 ms
6,160 KB
testcase_11 AC 21 ms
4,376 KB
testcase_12 AC 156 ms
5,144 KB
testcase_13 AC 135 ms
5,004 KB
testcase_14 AC 36 ms
4,376 KB
testcase_15 AC 53 ms
4,376 KB
testcase_16 AC 20 ms
4,376 KB
testcase_17 AC 135 ms
5,000 KB
testcase_18 AC 36 ms
4,380 KB
testcase_19 AC 64 ms
4,376 KB
testcase_20 AC 240 ms
6,448 KB
testcase_21 AC 231 ms
6,148 KB
testcase_22 AC 238 ms
6,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y));
#define chmax(x,y) x = max((x),(y));
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e17;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

template<typename T>
vector<T> compress(vector<T> &a){
    vector<T> val = a;
    int n = (int)a.size();
    sort(val.begin(),val.end());
    val.erase(unique(val.begin(),val.end()),val.end());
    for(int i=0;i<n;i++){
        a[i] = lower_bound(val.begin(),val.end(),a[i]) - val.begin();
    }
    return val;
}

int main(){
    ll h,w,q;
    cin >> h >> w >> q;
    vector<ll> y(q),x(q);
    rep(i,q){
        cin >> y[i] >> x[i];
        --y[i];--x[i];
    }
    vector<ll> val = compress(x);
    vector<ll> ok(val.size(),h);
    ll ans = h*w;
    rep(i,q){
        if(ok[x[i]] >= y[i]){
            ans -= ok[x[i]] - y[i];
            ok[x[i]] = y[i];
        }
        cout << ans << endl;
    }
    
    return 0;
}
0