結果

問題 No.60 魔法少女
ユーザー kuuso1kuuso1
提出日時 2014-11-09 23:43:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 841 ms / 5,000 ms
コード長 1,661 bytes
コンパイル時間 2,965 ms
コンパイル使用メモリ 105,428 KB
実行使用メモリ 52,940 KB
最終ジャッジ日時 2023-08-30 02:51:20
合計ジャッジ時間 9,562 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
47,672 KB
testcase_01 AC 98 ms
49,836 KB
testcase_02 AC 96 ms
49,744 KB
testcase_03 AC 98 ms
49,684 KB
testcase_04 AC 612 ms
52,004 KB
testcase_05 AC 414 ms
52,928 KB
testcase_06 AC 814 ms
50,840 KB
testcase_07 AC 617 ms
52,580 KB
testcase_08 AC 400 ms
50,432 KB
testcase_09 AC 236 ms
50,160 KB
testcase_10 AC 746 ms
48,840 KB
testcase_11 AC 125 ms
50,028 KB
testcase_12 AC 307 ms
52,760 KB
testcase_13 AC 841 ms
52,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int GETA=1050;
		int[][] Map=new int[2100][];
		for(int i=0;i<2100;i++){
			Map[i]=new int[2100];
		}
		
		int AX,AY,AW,AH,AD;
		for(int k=K;k>0;k--){
			var d=ria();
			AX=d[0];AY=d[1];AW=d[2];AH=d[3];AD=d[4];
			for(int Y=AY+GETA;Y<=AY+AH+GETA;Y++){
				Map[Y][AX+GETA]+=AD;
				Map[Y][AX+AW+GETA+1]-=AD;
			}
		}
		
		for(int i=1;i<2100;i++){
			for(int j=1;j<2100;j++){
				Map[i][j]+=Map[i][j-1];
			}
		}
		
		int cnt=0;
		for(int i=0;i<X.Length;i++){
			cnt+=Map[Y[i]+GETA][X[i]+GETA]>H[i]?0:H[i]-Map[Y[i]+GETA][X[i]+GETA];
		}
		
		Console.WriteLine(cnt);
		
	}
	int N;
	int K;
	int[] X;
	int[] Y;
	int[] H;
	
	
	
	public Sol(){
		var d=ria();
		N=d[0];K=d[1];
		X=new int[N];
		Y=new int[N];
		H=new int[N];
		for(int i=0;i<N;i++){
			var dd=ria();
			X[i]=dd[0];
			Y[i]=dd[1];
			H[i]=dd[2];
		}
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0