結果
| 問題 |
No.1338 Giant Class
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-15 22:02:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 58 ms / 2,000 ms |
| コード長 | 595 bytes |
| コンパイル時間 | 2,013 ms |
| コンパイル使用メモリ | 198,332 KB |
| 最終ジャッジ日時 | 2025-01-17 19:24:01 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll H, W, Q;
cin >> H >> W >> Q;
unordered_map<ll, ll> mp;
ll ans = H * W;
rep(q, Q) {
int y, x;
cin >> y >> x;
--y;
--x;
if (mp.find(x) == mp.end()) {
ans -= (H - y);
mp[x] = y;
} else if (mp[x] > y) {
ans -= (mp[x] - y);
mp[x] = y;
}
cout << ans << "\n";
}
return 0;
}