結果
問題 |
No.1338 Giant Class
|
ユーザー |
![]() |
提出日時 | 2021-01-16 09:05:36 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 636 ms / 2,000 ms |
コード長 | 865 bytes |
コンパイル時間 | 1,859 ms |
コンパイル使用メモリ | 103,808 KB |
実行使用メモリ | 26,496 KB |
最終ジャッジ日時 | 2024-11-27 08:39:34 |
合計ジャッジ時間 | 10,575 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.
ソースコード
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); } } }