제출 #800711

#제출 시각아이디문제언어결과실행 시간메모리
800711firewater선물상자 (IOI15_boxes)C++14
100 / 100
503 ms274336 KiB
#include "boxes.h" #include <stdio.h> #include <stdlib.h> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define ll long long using namespace std; #define N 10001000 ll n,k,ans,x,len,a[N],f[N],g[N]; long long delivery(int NN, int K, int L, int ppp[]) { n=NN; k=K; len=L; for(ll i=1;i<=n;++i) a[i]=ppp[i-1]; memset(f,0x7f,sizeof(f)); memset(g,0x7f,sizeof(g)); ans=len*n; f[0]=0; g[n+1]=0; for(int i=1;i<=n;++i) f[i]=f[max(i-k,0ll)]+min(a[i]*2,len*2); for(int i=n;i>0;--i) g[i]=g[min(i+k,n+1)]+min((len-a[i])*2,len); for(int i=0;i<=n;++i) ans=min(ans,f[i]+g[i+1]); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:45:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   45 |     for(int i=n;i>0;--i)
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...