結果

問題 No.1338 Giant Class
ユーザー トッティトッティ
提出日時 2021-01-15 22:11:42
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 247 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 1,384 ms
コンパイル使用メモリ 91,172 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2023-08-17 17:23:40
合計ジャッジ時間 5,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 192 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 142 ms
5,776 KB
testcase_07 AC 210 ms
7,936 KB
testcase_08 AC 129 ms
5,504 KB
testcase_09 AC 123 ms
5,556 KB
testcase_10 AC 222 ms
7,896 KB
testcase_11 AC 20 ms
4,376 KB
testcase_12 AC 148 ms
5,520 KB
testcase_13 AC 133 ms
5,564 KB
testcase_14 AC 35 ms
4,376 KB
testcase_15 AC 53 ms
4,376 KB
testcase_16 AC 19 ms
4,376 KB
testcase_17 AC 139 ms
5,508 KB
testcase_18 AC 35 ms
4,376 KB
testcase_19 AC 65 ms
4,376 KB
testcase_20 AC 244 ms
7,904 KB
testcase_21 AC 247 ms
7,848 KB
testcase_22 AC 246 ms
7,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <unordered_map>

int main() {
  int64_t height, width, nq;
  std::cin >> height >> width >> nq;

  std::unordered_map<size_t, int64_t> map;
  size_t now = width * height;
  int64_t h, w;
  for (size_t i = 0; i < nq; i++) {
    std::cin >> h >> w;
    h--;
    auto f = map.find(w);
    if (f != map.end()) {
      auto &pair = *f;
      if (pair.second > h) {
        now -= pair.second - h;
        pair.second = h;
      }
    } else {
      now -= height - h;
      map[w] = h;
    }
    std::cout << now << std::endl;
  }
}
0