結果
問題 | No.60 魔法少女 |
ユーザー | Ysmr_Ry |
提出日時 | 2014-11-10 21:33:29 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 78 ms / 5,000 ms |
コード長 | 1,062 bytes |
コンパイル時間 | 279 ms |
コンパイル使用メモリ | 40,324 KB |
実行使用メモリ | 7,884 KB |
最終ジャッジ日時 | 2023-08-30 03:04:28 |
合計ジャッジ時間 | 1,791 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 9 ms
6,900 KB |
testcase_01 | AC | 10 ms
6,912 KB |
testcase_02 | AC | 10 ms
6,904 KB |
testcase_03 | AC | 9 ms
6,952 KB |
testcase_04 | AC | 42 ms
7,036 KB |
testcase_05 | AC | 48 ms
7,788 KB |
testcase_06 | AC | 77 ms
7,832 KB |
testcase_07 | AC | 56 ms
7,260 KB |
testcase_08 | AC | 41 ms
7,136 KB |
testcase_09 | AC | 19 ms
7,028 KB |
testcase_10 | AC | 72 ms
7,884 KB |
testcase_11 | AC | 15 ms
6,976 KB |
testcase_12 | AC | 35 ms
7,332 KB |
testcase_13 | AC | 78 ms
7,784 KB |
ソースコード
#include<cstdio> #include<numeric> #include<vector> #define rep(i,a) for(int i=0;i<(a);++i) struct dat { int x, y, hp; dat( int x, int y, int hp ) : x(x), y(y), hp(hp) {} }; int N, K; int fld[1002][1002]; std::vector<dat> pts; int main() { scanf( "%d%d", &N, &K ); rep( i, N ) { int x, y, hp; scanf( "%d%d%d", &x, &y, &hp ); pts.push_back( dat( x, y, hp ) ); } rep( i, K ) { int ax, ay, w, h, d; scanf( "%d%d%d%d%d", &ax, &ay, &w, &h, &d ); ax += 500, ay += 500; fld[ay][ax] -= d; if( ax+w+1 <= 1000 ) fld[ay][ax+w+1] += d; if( ay+h+1 <= 1000 ) fld[ay+h+1][ax] += d; if( ax+w+1 <= 1000 && ay+h+1 <= 1000 ) fld[ay+h+1][ax+w+1] -= d; } rep( i, 1002 ) std::partial_sum( fld[i], fld[i]+1002, fld[i] ); rep( j, 1002 ) rep( i, 1001 ) fld[i+1][j] += fld[i][j]; int ans = 0; rep( i, N ) { fld[pts[i].y+500][pts[i].x+500] += pts[i].hp; if( fld[pts[i].y+500][pts[i].x+500] > 0 ) ans += fld[pts[i].y+500][pts[i].x+500]; } printf( "%d\n", ans ); return 0; }