結果
問題 | No.60 魔法少女 |
ユーザー | 37zigen |
提出日時 | 2016-05-04 16:43:46 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,051 bytes |
コンパイル時間 | 2,353 ms |
コンパイル使用メモリ | 77,424 KB |
実行使用メモリ | 106,092 KB |
最終ジャッジ日時 | 2024-04-15 11:20:31 |
合計ジャッジ時間 | 16,872 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 226 ms
76,180 KB |
testcase_01 | AC | 222 ms
76,460 KB |
testcase_02 | AC | 228 ms
76,640 KB |
testcase_03 | AC | 223 ms
76,356 KB |
testcase_04 | AC | 1,212 ms
104,916 KB |
testcase_05 | AC | 1,270 ms
103,200 KB |
testcase_06 | AC | 1,491 ms
104,260 KB |
testcase_07 | AC | 1,337 ms
100,980 KB |
testcase_08 | AC | 1,172 ms
104,820 KB |
testcase_09 | AC | 781 ms
97,784 KB |
testcase_10 | AC | 1,466 ms
102,780 KB |
testcase_11 | WA | - |
testcase_12 | AC | 1,051 ms
104,504 KB |
testcase_13 | AC | 1,448 ms
106,092 KB |
ソースコード
package yukicoder; import java.util.Scanner; public class Main{ public static void main(String[] args)throws Exception{ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); int[][] table=new int[2000][2000]; for(int i=0;i<n;i++){ int x=sc.nextInt()+500; int y=sc.nextInt()+500; int hp=sc.nextInt(); table[y][x]+=hp; } int[][] damage=new int[2000][2000]; for(int i=0;i<k;i++){ int x=sc.nextInt()+500; int y=sc.nextInt()+500; int w=sc.nextInt(); int h=sc.nextInt(); int d=sc.nextInt(); damage[y][x]+=d;damage[y][x+w+1]=-d; damage[y+h+1][x]-=d;damage[y+h+1][w+x+1]+=d; } for(int i=0;i<1000;i++){ for(int j=1;j<1000;j++){ damage[i][j]+=damage[i][j-1]; } } for(int i=0;i<1000;i++){ for(int j=1;j<1000;j++){ damage[j][i]+=damage[j-1][i]; } } long res=0; for(int i=0;i<1000;i++){ for(int j=0;j<1000;j++){ if(table[i][j]>damage[i][j])res+=table[i][j]-damage[i][j]; } } System.out.println(res); } }