結果

問題 No.1338 Giant Class
ユーザー zlnzln
提出日時 2021-01-15 22:22:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 1,062 bytes
コンパイル時間 1,333 ms
コンパイル使用メモリ 125,800 KB
最終ジャッジ日時 2025-01-17 19:41:29
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <random>

#ifdef DEBUG
#include "library/Utility/debug.cpp"
#else
#define debug(...)
#endif

#define rep(i,n) for(int i=0;i<(n);++i)
#define EL '\n'
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using lnt = long long;
struct FIO{FIO(){std::cin.tie(0);std::ios_base::sync_with_stdio(0);std::cout<<std::fixed<<std::setprecision(15);}}fIO;
template<typename T> using V = std::vector<T>;
template<typename T> void fill(V<T>&v) { for(T&e:v) std::cin >> e; }
/*-*/

int main() {
	lnt h,w,q;
	std::cin >> h >> w >> q;
	std::map<lnt,lnt> map;
	lnt ans=h*w;
	rep(qq,q) {
		lnt y,x;
		std::cin >> y >> x;
		lnt yy=h+1;
		if(map.count(x)) {
			yy=map[x];
		}
		if(yy>y) {
			ans-=yy-y;
			map[x]=y;
		}
		print(ans);
	}
}
0