F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_19991897_18652.cpp:1:909: fatal error: GCC4.9.2/x86_64-w64-mingw32/include/c++/bits/stdc++.h>usin: Invalid argument
 #include<bits/stdc++.h>using namespace std;const int maxn = 500050;int a[maxn], sum[maxn], dp[maxn];int que[maxn], st, ed;int N, M;int GETUP(int i, int j){    return dp[j] + sum[j] * sum[j] - dp[i] - sum[i] * sum[i];}int GETDOWN(int i, int j){    return 2 * (sum[j] - sum[i]);}int GETDP(int i, int j){ dp[j] = dp[i] + (sum[j] - sum[i]) * (sum[j] - sum[i]) + M;}int main (){    while(~scanf("%d%d", &N, &M))    {        for(int i = 1; i <= N; i++)        { scanf("%d", &a[i]); sum[i] = sum[i - 1] + a[i];        } st = 0, ed = 1; que[st] = 0;        for(int i = 1; i <= N; i++)        {            while(st + 1 < ed && GETUP(que[st], que[st + 1]) < sum[i]*GETDOWN(que[st], que[st + 1])) st++; GETDP(que[st], i);            while(st+1<ed&&(GETUP(que[ed-2],que[ed-1])*GETDOWN(que[ed-1],i))>(GETUP(que[ed-1],i)*GETDOWN(que[ed-2],que[ed-1]))) ed--; que[ed++] = i;        } printf("%d\n",dp[N]);    }    return 0;}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
compilation terminated.


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-23 04:26:30, Gzip enabled