結果

問題 No.1338 Giant Class
ユーザー bluemeganebluemegane
提出日時 2021-01-16 09:07:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 959 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 63,448 KB
実行使用メモリ 39,080 KB
最終ジャッジ日時 2023-08-18 05:36:43
合計ジャッジ時間 5,886 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
22,736 KB
testcase_01 AC 65 ms
20,816 KB
testcase_02 AC 176 ms
30,876 KB
testcase_03 AC 63 ms
22,808 KB
testcase_04 AC 64 ms
18,724 KB
testcase_05 AC 65 ms
20,648 KB
testcase_06 AC 150 ms
30,868 KB
testcase_07 AC 189 ms
34,760 KB
testcase_08 AC 147 ms
32,536 KB
testcase_09 AC 137 ms
32,012 KB
testcase_10 AC 200 ms
35,068 KB
testcase_11 AC 77 ms
23,356 KB
testcase_12 AC 162 ms
30,724 KB
testcase_13 AC 147 ms
31,288 KB
testcase_14 AC 87 ms
28,376 KB
testcase_15 AC 96 ms
29,400 KB
testcase_16 AC 74 ms
23,056 KB
testcase_17 AC 145 ms
31,328 KB
testcase_18 AC 87 ms
24,176 KB
testcase_19 AC 103 ms
27,912 KB
testcase_20 AC 210 ms
39,080 KB
testcase_21 AC 212 ms
37,936 KB
testcase_22 AC 210 ms
37,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Text;
using System.Collections.Generic;
using System;

public class Hello
{
    public static long h, w;
    public static int q;
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        h = long.Parse(line[0]);
        w = long.Parse(line[1]);
        q = int.Parse(line[2]);
        getAns();
    }
    static void getAns()
    {
        var sb = new StringBuilder();
        var ans = h * w;
        var dw = new Dictionary<int, int>();
        for (int i = 0; i < q; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var x = int.Parse(line[0]) - 1;
            var y = int.Parse(line[1]) - 1;
            if (dw.ContainsKey(y))
            {
                if (x < dw[y]) { ans -= dw[y] - x; dw[y] = x; }
            }
            else { ans -= h - x; dw[y] = x; }
            sb.Append(ans.ToString() + "\n");
        }
        Console.Write(sb);
    }
}
0