結果

問題 No.1338 Giant Class
ユーザー さかぽん
提出日時 2021-02-19 11:46:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 938 bytes
コンパイル時間 3,494 ms
コンパイル使用メモリ 107,008 KB
実行使用メモリ 27,264 KB
最終ジャッジ日時 2024-09-15 20:50:21
合計ジャッジ時間 7,451 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;

class D
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
	static (int, int, int) Read3() { var a = Read(); return (a[0], a[1], a[2]); }
	static void Main()
	{
		Console.SetOut(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
		var (h, w, qc) = Read3();
		var qs = Array.ConvertAll(new bool[qc], _ => Read2());

		var r = (long)h * w;
		var map = new Map<int, int>(h + 1);

		foreach (var (y, x) in qs)
		{
			var t = map[x];
			if (t > y)
			{
				r -= t - y;
				map[x] = y;
			}
			Console.WriteLine(r);
		}
		Console.Out.Flush();
	}
}

class Map<TK, TV> : Dictionary<TK, TV>
{
	TV _v0;
	public Map(TV v0 = default(TV)) { _v0 = v0; }

	public new TV this[TK key]
	{
		get { return ContainsKey(key) ? base[key] : _v0; }
		set { base[key] = value; }
	}
}
0