結果
問題 | No.60 魔法少女 |
ユーザー | 37zigen |
提出日時 | 2016-05-04 16:38:51 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,050 bytes |
コンパイル時間 | 2,396 ms |
コンパイル使用メモリ | 77,692 KB |
実行使用メモリ | 117,780 KB |
最終ジャッジ日時 | 2024-04-15 11:19:46 |
合計ジャッジ時間 | 16,982 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 213 ms
86,000 KB |
testcase_01 | AC | 211 ms
85,944 KB |
testcase_02 | AC | 220 ms
85,912 KB |
testcase_03 | AC | 219 ms
86,188 KB |
testcase_04 | AC | 1,187 ms
117,032 KB |
testcase_05 | AC | 1,277 ms
113,912 KB |
testcase_06 | AC | 1,437 ms
116,208 KB |
testcase_07 | AC | 1,317 ms
111,628 KB |
testcase_08 | AC | 1,148 ms
116,048 KB |
testcase_09 | AC | 805 ms
111,016 KB |
testcase_10 | AC | 1,420 ms
114,120 KB |
testcase_11 | WA | - |
testcase_12 | AC | 1,103 ms
112,920 KB |
testcase_13 | AC | 1,472 ms
117,780 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]; } } int 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); } }