結果
問題 |
No.1338 Giant Class
|
ユーザー |
|
提出日時 | 2021-05-29 12:41:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 306 ms / 2,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 172,748 KB |
実行使用メモリ | 9,728 KB |
最終ジャッジ日時 | 2024-11-07 21:09:24 |
合計ジャッジ時間 | 7,602 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair<int, int> int main() { ll h, w; int q; cin >> h >> w >> q; map<ll, ll> mp; ll sum = h*w; rep(qi,q) { ll x, y; cin >> x >> y; if (mp[y] == 0) { // y列目にまだ誰も座っていないとき mp[y] = x; sum -= h-x+1; } else { // y列目にすでに座っているとき if (mp[y] > x) { // より前方に座るとき sum -= mp[y]-x; mp[y] = x; } } cout << sum << endl; } }