結果
| 問題 |
No.60 魔法少女
|
| コンテスト | |
| ユーザー |
IL_msta
|
| 提出日時 | 2015-07-13 11:36:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 68 ms / 5,000 ms |
| コード長 | 1,609 bytes |
| コンパイル時間 | 683 ms |
| コンパイル使用メモリ | 85,148 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-07-08 06:44:12 |
| 合計ジャッジ時間 | 2,601 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 |
ソースコード
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
//#include <array>
#include <list>
#include <queue>
#include <vector>
#include <complex>
#include <set>
#include <map>
/////////
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define P(p) cout<<(p)<<endl;
#define PII pair<int,int>
/////////
typedef long long LL;
typedef long double LD;
/////////
using namespace::std;
/////////
const int KMax = 100000;
int Ex[KMax],Ey[KMax],EH[KMax];
int tiles[1001][1001];
int main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//
//cout << setprecision(10);//
int N,K;
int x,y,w,h,d;
cin>>N>>K;
rep(i,N){
cin>>x>>y>>EH[i];
Ex[i] = x+500;
Ey[i] = y+500;
}
rep(i,K){
cin>>x>>y>>w>>h>>d;
x += 500;
y += 500;
tiles[y][x] += d;
if(x+w+1 <= 1000){
tiles[y][x+w+1] -= d;
}
if(y+h+1 <= 1000){
tiles[y+h+1][x] -= d;
}
if( x+w+1 <= 1000 && y+h+1 <= 1000){
tiles[y+h+1][x+w+1] += d;
}
}
//横
for(int Y = 0; Y <= 1000; ++Y){
for(int X = 1; X <= 1000; ++X){
tiles[Y][X] += tiles[Y][X-1];
}
}
//縦
for(int Y = 1; Y <= 1000; ++Y){
for(int X = 0; X <= 1000; ++X){
tiles[Y][X] += tiles[Y-1][X];
}
}
////
/*
for(int Y=490; Y <=500+10;++Y){
for(int X=490; X <= 510; ++X){
cout << tiles[Y][X] << " ";
}
cout << endl;
}
*/
///////////
int ans = 0;
int temp;
rep(i,N){
//Ex[i],Ey[i],EH[i]
temp = EH[i] - tiles[ Ey[i] ][ Ex[i] ];
if(temp > 0){
ans += temp;
}
}
P(ans);
return 0;
}
IL_msta