結果
問題 | No.60 魔法少女 |
ユーザー | kuuso1 |
提出日時 | 2014-11-09 23:43:14 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 836 ms / 5,000 ms |
コード長 | 1,661 bytes |
コンパイル時間 | 1,146 ms |
コンパイル使用メモリ | 114,756 KB |
実行使用メモリ | 57,860 KB |
最終ジャッジ日時 | 2024-12-31 09:02:08 |
合計ジャッジ時間 | 7,628 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; 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));} }