結果
問題 | No.1338 Giant Class |
ユーザー | どらら |
提出日時 | 2021-01-15 22:08:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 254 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 1,527 ms |
コンパイル使用メモリ | 174,376 KB |
実行使用メモリ | 8,076 KB |
最終ジャッジ日時 | 2024-11-26 15:04:38 |
合計ジャッジ時間 | 5,696 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; int main(){ ll H, W, Q; cin >> H >> W >> Q; unordered_map<ll,ll> memo; ll ret = H * W; rep(q,Q){ ll y, x; cin >> y >> x; ll idx = memo[x]; if(idx == 0) idx = H+1; if(y < idx){ ret -= idx-1; ret += y-1; memo[x] = y; } cout << ret << endl; } return 0; }