結果
問題 | No.1338 Giant Class |
ユーザー |
![]() |
提出日時 | 2021-01-15 23:10:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 268 ms / 2,000 ms |
コード長 | 409 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 76,808 KB |
実行使用メモリ | 9,856 KB |
最終ジャッジ日時 | 2024-11-26 17:18:32 |
合計ジャッジ時間 | 5,516 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <iostream>#include <map>#define int long longusing namespace std;int h, w, q;int y, x;map<int, int> mp;signed main() {cin >> h >> w >> q;int ans = h * w;for (int i = 0; i < q; i++) {cin >> y >> x; y--;if (mp.find(x) == mp.end()) {mp[x] = y;ans = ans - h + y;}else if (mp[x] > y) {ans = ans + y - mp[x];mp[x] = y;}cout << ans << endl;}return 0;}