結果

問題 No.1338 Giant Class
ユーザー bluemeganebluemegane
提出日時 2021-01-16 07:54:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 941 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 64,928 KB
実行使用メモリ 39,908 KB
最終ジャッジ日時 2023-08-18 04:16:07
合計ジャッジ時間 6,770 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
20,760 KB
testcase_01 AC 63 ms
20,748 KB
testcase_02 AC 170 ms
31,620 KB
testcase_03 AC 65 ms
22,728 KB
testcase_04 AC 66 ms
20,776 KB
testcase_05 AC 67 ms
22,788 KB
testcase_06 AC 148 ms
33,416 KB
testcase_07 AC 185 ms
35,328 KB
testcase_08 AC 142 ms
33,000 KB
testcase_09 AC 136 ms
32,488 KB
testcase_10 AC 194 ms
36,760 KB
testcase_11 AC 77 ms
23,480 KB
testcase_12 AC 155 ms
31,188 KB
testcase_13 AC 143 ms
33,908 KB
testcase_14 AC 84 ms
24,072 KB
testcase_15 AC 97 ms
25,572 KB
testcase_16 AC 74 ms
19,124 KB
testcase_17 AC 141 ms
31,892 KB
testcase_18 AC 84 ms
24,128 KB
testcase_19 AC 101 ms
30,056 KB
testcase_20 AC 200 ms
39,800 KB
testcase_21 AC 200 ms
37,888 KB
testcase_22 AC 203 ms
39,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 ans = h * w;
        var res = new long[q];
        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; }
            res[i] = ans;
        }
        Console.WriteLine(string.Join("\n", res));
    }
}
0