結果
| 問題 | No.60 魔法少女 | 
| コンテスト | |
| ユーザー |  14番 | 
| 提出日時 | 2016-04-07 07:56:42 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 570 ms / 5,000 ms | 
| コード長 | 2,527 bytes | 
| コンパイル時間 | 779 ms | 
| コンパイル使用メモリ | 112,112 KB | 
| 実行使用メモリ | 37,372 KB | 
| 最終ジャッジ日時 | 2024-10-04 02:27:37 | 
| 合計ジャッジ時間 | 5,608 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 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(){
        Reader.IsDebug = false;
        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 = @"
";
}
            
            
            
        