結果
| 問題 | 
                            No.1338 Giant Class
                             | 
                    
| コンテスト | |
| ユーザー | 
                             トッティ
                         | 
                    
| 提出日時 | 2021-01-15 22:11:42 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 236 ms / 2,000 ms | 
| コード長 | 557 bytes | 
| コンパイル時間 | 690 ms | 
| コンパイル使用メモリ | 127,872 KB | 
| 実行使用メモリ | 7,952 KB | 
| 最終ジャッジ日時 | 2024-11-26 15:12:31 | 
| 合計ジャッジ時間 | 4,721 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 21 | 
ソースコード
#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;
  }
}
            
            
            
        
            
トッティ