結果
| 問題 |
No.60 魔法少女
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-04-07 07:55:51 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,848 bytes |
| コンパイル時間 | 1,053 ms |
| コンパイル使用メモリ | 105,984 KB |
| 実行使用メモリ | 21,248 KB |
| 最終ジャッジ日時 | 2024-10-04 02:27:26 |
| 合計ジャッジ時間 | 3,675 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | WA * 10 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Text;
public class Program
{
public void Proc(){
int[] inpt = Reader.GetInt(' ', true);
int tekiCount = inpt[0];
int kougekiCount = inpt[1];
int[,] teki = new int[1002, 1002];
for(int i=0; i<tekiCount; i++) {
inpt = Reader.GetInt(' ', true);
teki[inpt[1] + 500, inpt[0] + 500] = inpt[2];
}
int[,] map = new int[1002,1002];
for(int i=0; i<kougekiCount; i++) {
inpt = Reader.GetInt(' ', true);
int x = inpt[0] + 500;
int y = inpt[1] + 500;
int w = inpt[2];
int h = inpt[3];
int d = inpt[4];
int rowMax = Math.Min(y+h, map.GetLength(0) - 1);
int colMax = Math.Min(x+w + 1, map.GetLength(1) - 1);
for(int j=y; j<=rowMax; j++) {
map[j, x]+=d;
map[j, colMax] -= d;
}
}
int currentNum = 0;
long ans = 0;
for(int i=0; i<map.GetLength(0); i++) {
for(int j=0; j<map.GetLength(1); j++) {
currentNum += map[i,j];
if(teki[i,j] > currentNum) {
ans += (teki[i,j] - currentNum);
}
}
}
Console.WriteLine(ans.ToString("#########################0"));
}
public static void Main(string[] args)
{
Program prg = new Program();
prg.Proc();
}
}
class Reader
{
public static bool IsDebug = true;
private static System.IO.StringReader sr;
public static string ReadLine() {
if(IsDebug) {
if(sr == null) {
sr = new System.IO.StringReader(initStr.Trim());
}
return sr.ReadLine();
} else {
return Console.ReadLine();
}
}
public static int[] GetInt(char delimiter = ' ', bool mustTrim = false) {
string src = ReadLine();
if(mustTrim) {
src = src.Trim();
}
string[] inpt = src.Split(delimiter);
int[] ret = new int[inpt.Length];
for(int i=0; i<inpt.Length; i++) {
string item = inpt[i];
if(mustTrim) {
item = item.Trim();
}
ret[i] = int.Parse(item);
}
return ret;
}
private static string initStr = @"
10 10
-444 -456 6808
465 31 3659
-16 103 7545
199 342 7710
374 -206 4493
-15 -286 2504
-287 155 8841
-345 -444 3170
-7 304 9561
-143 -456 279
-349 154 13 268 3811
-40 256 150 80 8822
486 270 394 337 5486
310 -342 92 195 6358
111 -243 209 445 5669
-224 -120 197 31 904
436 -206 50 25 7802
-394 -493 409 229 4934
-388 367 136 14 3866
-79 -157 37 426 1670
";
}
14番