結果
問題 |
No.1338 Giant Class
|
ユーザー |
![]() |
提出日時 | 2022-12-23 21:58:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 331 ms / 2,000 ms |
コード長 | 467 bytes |
コンパイル時間 | 2,098 ms |
コンパイル使用メモリ | 198,392 KB |
最終ジャッジ日時 | 2025-02-09 19:28:16 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int h, w, q; cin >> h >> w >> q; map<int, int> mp; long long ans = (ll)h * w; for (int i = 0; i < q; i++) { int x, y; cin >> y >> x; if (mp[x] == 0) { ans -= (h - y + 1); mp[x] = y; } else if (mp[x] > y) { ans -= mp[x] - y; mp[x] = y; } cout << ans << endl; } }