結果
問題 | No.1338 Giant Class |
ユーザー |
![]() |
提出日時 | 2021-03-21 14:02:51 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 337 ms / 2,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 806 ms |
コンパイル使用メモリ | 81,320 KB |
実行使用メモリ | 8,832 KB |
最終ジャッジ日時 | 2024-11-22 06:40:15 |
合計ジャッジ時間 | 6,025 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <iostream>#include <vector>#include <map>using namespace std;using ll = long long int;int main(){int h, w, q;cin >> h >> w >> q;ll ans = (ll)h*w;vector<int> y(q), x(q);map<int, int> memo;for(int i = 0; i < q; i++){cin >> y[i] >> x[i];memo[x[i]] = h;}for(int i = 0; i < q; i++){if(memo[x[i]] > y[i]-1){ans -= memo[x[i]];ans += y[i]-1;memo[x[i]] = y[i]-1;}cout << ans << endl;}return 0;}