結果

問題 No.1338 Giant Class
ユーザー oooooba
提出日時 2021-11-20 18:36:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 967 bytes
コンパイル時間 1,183 ms
コンパイル使用メモリ 118,860 KB
最終ジャッジ日時 2025-01-25 22:15:05
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std; // NOLINT
int main() {
int32_t h, w, q;
cin >> h >> w >> q;
unordered_map<int32_t, int32_t> mp;
vector<int64_t> ans(q);
int64_t sum = int64_t(h) * w;
for (auto &&a : ans) {
int32_t y, x;
cin >> y >> x;
if (mp.find(x) == mp.end()) {
sum -= h - y + 1;
a = sum;
mp[x] = y;
} else {
auto yy = mp[x];
if (y < yy) {
sum -= yy - y;
a = sum;
mp[x] = y;
} else {
a = sum;
}
}
}
for (auto a : ans) {
cout << a << endl;
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0