結果
問題 | No.1338 Giant Class |
ユーザー | shun2741 |
提出日時 | 2021-01-15 22:02:58 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 295 ms / 2,000 ms |
コード長 | 1,269 bytes |
コンパイル時間 | 1,625 ms |
コンパイル使用メモリ | 172,632 KB |
実行使用メモリ | 9,616 KB |
最終ジャッジ日時 | 2023-08-17 17:10:02 |
合計ジャッジ時間 | 6,396 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 188 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 3 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 170 ms
7,464 KB |
testcase_07 | AC | 238 ms
9,172 KB |
testcase_08 | AC | 155 ms
7,024 KB |
testcase_09 | AC | 143 ms
6,664 KB |
testcase_10 | AC | 268 ms
9,520 KB |
testcase_11 | AC | 23 ms
4,376 KB |
testcase_12 | AC | 175 ms
6,420 KB |
testcase_13 | AC | 161 ms
6,896 KB |
testcase_14 | AC | 41 ms
4,380 KB |
testcase_15 | AC | 60 ms
4,904 KB |
testcase_16 | AC | 21 ms
4,376 KB |
testcase_17 | AC | 160 ms
6,920 KB |
testcase_18 | AC | 39 ms
4,376 KB |
testcase_19 | AC | 70 ms
5,296 KB |
testcase_20 | AC | 282 ms
9,568 KB |
testcase_21 | AC | 295 ms
9,564 KB |
testcase_22 | AC | 286 ms
9,616 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; // 型定義 typedef long long ll; typedef pair<ll, ll> P; // forループ #define REP(i,n) for(ll i=0; i<(ll)(n); ++i) // 定数宣言 const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; // グラフ表現 using Graph = vector<vector<int>>; // グラフの辺表現 using Edge = map<pair<int,int>,int>; // n次元配列の初期化。第2引数の型のサイズごとに初期化していく。 template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){ std::fill( (T*)array, (T*)(array+N), val ); } // 最大公約数 ll gcd(ll a,ll b){ if (a%b == 0) return(b); else return(gcd(b, a%b)); } // 最小公倍数 ll lcm(ll a, ll b){ return a/gcd(a, b) * b; } int main() { cout << fixed << setprecision(15); ll H, W, Q; cin >> H >> W >> Q; map<ll,ll> A; ll ans = H*W; REP(q, Q){ ll y, x; cin >> y >> x; // cout << y << " " << x << " " << A[x] << endl; if(A.count(x)){ if(y < A[x]){ ans -= (A[x] - y); A[x] = y; } } else{ A[x] = y; ans -= (H-y+1); } cout << ans << endl; } return 0; }