結果

問題 No.60 魔法少女
ユーザー 14番14番
提出日時 2016-04-07 07:55:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,848 bytes
コンパイル時間 867 ms
コンパイル使用メモリ 114,252 KB
実行使用メモリ 33,408 KB
最終ジャッジ日時 2024-04-14 22:23:16
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 77 ms
33,408 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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


";
}

0