結果

問題 No.1338 Giant Class
ユーザー Fu_LFu_L
提出日時 2021-05-13 23:19:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 765 bytes
コンパイル時間 5,721 ms
コンパイル使用メモリ 268,172 KB
実行使用メモリ 9,844 KB
最終ジャッジ日時 2023-10-26 03:15:51
合計ジャッジ時間 8,455 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 33 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 54 ms
7,504 KB
testcase_07 AC 81 ms
9,156 KB
testcase_08 AC 48 ms
7,212 KB
testcase_09 AC 46 ms
6,940 KB
testcase_10 AC 88 ms
9,688 KB
testcase_11 AC 7 ms
4,348 KB
testcase_12 AC 56 ms
6,676 KB
testcase_13 AC 49 ms
7,156 KB
testcase_14 AC 13 ms
4,544 KB
testcase_15 AC 18 ms
5,008 KB
testcase_16 AC 7 ms
4,348 KB
testcase_17 AC 49 ms
7,168 KB
testcase_18 AC 12 ms
4,524 KB
testcase_19 AC 23 ms
5,276 KB
testcase_20 AC 93 ms
9,844 KB
testcase_21 AC 95 ms
9,844 KB
testcase_22 AC 95 ms
9,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef modint1000000007 mint;
typedef pair<ll,ll> P;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
const ll inf=1e18;
ll h,w,q;
ll ans;
P p;
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>h>>w>>q;
    ans=h*w;
    map<ll,ll> m;
    while(q--){
        cin>>p.first>>p.second;
        auto itr=m.find(p.second);
        if(itr==m.end()){
            ans-=(h-p.first+1);
            m[p.second]=p.first;
        }else{
            if(m[p.second]>p.first){
                ans-=(m[p.second]-p.first);
                m[p.second]=p.first;
            }
        }
        cout<<ans<<"\n";
    }
}
0