結果
問題 |
No.1338 Giant Class
|
ユーザー |
![]() |
提出日時 | 2021-01-16 07:54:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 168 ms / 2,000 ms |
コード長 | 941 bytes |
コンパイル時間 | 3,554 ms |
コンパイル使用メモリ | 112,208 KB |
実行使用メモリ | 43,128 KB |
最終ジャッジ日時 | 2024-11-27 06:55:19 |
合計ジャッジ時間 | 7,407 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 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)); } }