結果

問題 No.1338 Giant Class
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-01-15 21:39:34
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 1,164 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 163,548 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-05-04 23:02:50
合計ジャッジ時間 5,884 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 142 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 112 ms
7,424 KB
testcase_07 AC 165 ms
8,960 KB
testcase_08 AC 109 ms
7,040 KB
testcase_09 AC 93 ms
6,784 KB
testcase_10 AC 179 ms
9,472 KB
testcase_11 AC 16 ms
5,376 KB
testcase_12 AC 124 ms
6,400 KB
testcase_13 AC 100 ms
6,912 KB
testcase_14 AC 27 ms
5,376 KB
testcase_15 AC 41 ms
5,376 KB
testcase_16 AC 14 ms
5,376 KB
testcase_17 AC 109 ms
6,912 KB
testcase_18 AC 26 ms
5,376 KB
testcase_19 AC 55 ms
5,376 KB
testcase_20 AC 192 ms
9,600 KB
testcase_21 AC 186 ms
9,600 KB
testcase_22 AC 206 ms
9,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(s) (s).begin(),(s).end()
#define vcin(n) for(ll i=0;i<ll(n.size());i++) cin>>n[i]
#define rever(vec) reverse(vec.begin(), vec.end())
#define sor(vec) sort(vec.begin(), vec.end())
#define fi first
#define se second
//const ll mod = 998244353;
const ll mod = 1000000007;
const ll inf = 2000000000000000000ll;
static const long double pi = 3.141592653589793;
template<class T,class U> void chmax(T& t,const U& u){if(t<u) t=u;}
template<class T,class U> void chmin(T& t,const U& u){if(t>u) t=u;}
ll modPow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }
int main() {
  /* mod は 1e9+7 */
  ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  cout<< fixed << setprecision(10);
  ll h,w,q;
  swap(h,w);
  cin>>h>>w>>q;
  map<ll,ll> m;
  ll ans=h*w;
  swap(h,w);
  for(int i=0;i<q;i++){
    ll x,y;
    cin>>x>>y;
    swap(x,y);
    if(m[x]==0){
      m[x]=y;
      ans-=w+1-y;
    }
    else if(m[x]>y){
      ans+=(y-m[x]);
      m[x]=y;
    }
    cout<<ans<<endl;
  }
}
0