結果
問題 | No.60 魔法少女 |
ユーザー | nanophoto12 |
提出日時 | 2014-11-10 01:06:12 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 548 ms / 5,000 ms |
コード長 | 1,877 bytes |
コンパイル時間 | 2,357 ms |
コンパイル使用メモリ | 105,288 KB |
実行使用メモリ | 43,356 KB |
最終ジャッジ日時 | 2023-08-30 02:59:08 |
合計ジャッジ時間 | 7,424 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 76 ms
23,300 KB |
testcase_01 | AC | 75 ms
25,396 KB |
testcase_02 | AC | 74 ms
23,188 KB |
testcase_03 | AC | 82 ms
29,492 KB |
testcase_04 | AC | 372 ms
43,204 KB |
testcase_05 | AC | 328 ms
41,236 KB |
testcase_06 | AC | 540 ms
41,164 KB |
testcase_07 | AC | 412 ms
41,280 KB |
testcase_08 | AC | 290 ms
43,276 KB |
testcase_09 | AC | 185 ms
43,244 KB |
testcase_10 | AC | 510 ms
43,204 KB |
testcase_11 | AC | 119 ms
37,628 KB |
testcase_12 | AC | 252 ms
43,356 KB |
testcase_13 | AC | 548 ms
41,204 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class Program { public static void Main(string[] args) { var first = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var enemies = new long[1001,1001]; int n = first[0]; int k = first[1]; const int offset = 500; for (int i = 0; i < n; i++) { var enemy = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); enemies[enemy[0] + offset, enemy[1] + offset] = enemy[2]; } var attacks = new long[1001, 1001]; for (int j = 0; j < k; j++) { var attack = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var left = attack[0] + offset; var top = attack[1] + offset; var right = left + attack[2] + 1; right = Math.Min(1000, right); var bottom = top + attack[3] + 1; bottom = Math.Min(1001, bottom); for (int y = top; y < bottom; y++) { attacks[left, y] += attack[4]; if (right == 1000) { if (y < 1000) { attacks[0, y + 1] -= attack[4]; } } else { attacks[right, y] -= attack[4]; } } } long current = 0; long sum = 0; for (int y = 0; y < 1001; y++) { for (int x = 0; x < 1001; x++) { current += attacks[x, y]; if (current < enemies[x, y]) { sum += enemies[x, y] - current; } } } Console.WriteLine(sum); } }