結果
| 問題 |
No.1338 Giant Class
|
| コンテスト | |
| ユーザー |
batsumaru
|
| 提出日時 | 2021-01-15 21:57:18 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 307 ms / 2,000 ms |
| コード長 | 728 bytes |
| コンパイル時間 | 1,625 ms |
| コンパイル使用メモリ | 173,324 KB |
| 実行使用メモリ | 9,728 KB |
| 最終ジャッジ日時 | 2024-11-26 14:29:19 |
| 合計ジャッジ時間 | 6,358 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())
int main() {
ll h, w, q;
cin >> h >> w >> q;
map<ll, ll> mp;
ll ans = h * w;
REP(_, q) {
ll y, x;
cin >> y >> x;
if (!mp.count(x)) {
ans -= h - y + 1;
mp[x] = y;
} else {
ans -= max(0LL, mp[x] - y);
mp[x] = min(mp[x], y);
}
cout << ans << endl;
}
}
batsumaru