結果

問題 No.60 魔法少女
ユーザー latte0119latte0119
提出日時 2016-02-26 21:31:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,214 bytes
コンパイル時間 1,809 ms
コンパイル使用メモリ 159,984 KB
実行使用メモリ 8,988 KB
最終ジャッジ日時 2023-10-23 20:23:00
合計ジャッジ時間 2,720 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,600 KB
testcase_01 AC 4 ms
8,600 KB
testcase_02 AC 4 ms
8,600 KB
testcase_03 AC 4 ms
8,600 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |     scanf("%d%d",&N,&K);
      |     ~~~~~^~~~~~~~~~~~~~
main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%d%d%d",&X[i],&Y[i],&H[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:36:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |         scanf("%d%d%d%d%d",&x,&y,&w,&h,&d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

//#define int long long

typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ln <<endl
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N,K;
int X[100000],Y[100000],H[100000];

int sum[1010][1010];

signed main(){
    scanf("%d%d",&N,&K);
    rep(i,N){
        scanf("%d%d%d",&X[i],&Y[i],&H[i]);
        X[i]+=500;Y[i]+=500;
    }

    rep(i,K){
        int x,y,w,h,d;
        scanf("%d%d%d%d%d",&x,&y,&w,&h,&d);
        x+=500;y+=500;w++;h++;chmin(w,1001-x);chmin(h,1001-y);
        sum[x][y]+=d;
        sum[x+w][y]-=d;
        sum[x][y+h]-=d;
        sum[x+w][y+h]+=d;
    }

    rep(i,1000)rep(j,1000)sum[i+1][j+1]+=sum[i][j+1]+sum[i+1][j]-sum[i][j];


    int ans=0;
    rep(i,N)ans+=max(0,H[i]-sum[X[i]][Y[i]]);
    printf("%d\n",ans);
    return 0;
}
0