結果

問題 No.1338 Giant Class
ユーザー bluemeganebluemegane
提出日時 2021-01-16 09:05:36
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 616 ms / 2,000 ms
コード長 865 bytes
コンパイル時間 847 ms
コンパイル使用メモリ 63,416 KB
実行使用メモリ 31,588 KB
最終ジャッジ日時 2023-08-18 05:35:14
合計ジャッジ時間 10,297 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
20,716 KB
testcase_01 AC 62 ms
18,752 KB
testcase_02 AC 571 ms
24,780 KB
testcase_03 AC 63 ms
20,664 KB
testcase_04 AC 65 ms
20,836 KB
testcase_05 AC 67 ms
22,704 KB
testcase_06 AC 405 ms
27,032 KB
testcase_07 AC 542 ms
29,192 KB
testcase_08 AC 379 ms
27,040 KB
testcase_09 AC 364 ms
28,932 KB
testcase_10 AC 599 ms
29,488 KB
testcase_11 AC 115 ms
24,888 KB
testcase_12 AC 458 ms
26,748 KB
testcase_13 AC 380 ms
29,024 KB
testcase_14 AC 147 ms
24,992 KB
testcase_15 AC 192 ms
23,772 KB
testcase_16 AC 111 ms
20,732 KB
testcase_17 AC 378 ms
29,052 KB
testcase_18 AC 148 ms
22,804 KB
testcase_19 AC 212 ms
25,928 KB
testcase_20 AC 616 ms
30,284 KB
testcase_21 AC 609 ms
31,456 KB
testcase_22 AC 616 ms
31,588 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 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; }
            Console.WriteLine(ans);
        }
    }
}
0