제출 #800703

#제출 시각아이디문제언어결과실행 시간메모리
800703firewater선물상자 (IOI15_boxes)C++14
20 / 100
1 ms212 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 100100 ll n,k,ans,x,len,a[N],b[N]; ll solve1(ll x) { ll now=0,num=0; while(now+k<=x) { now+=k; num+=min(a[now]*2,len); } if(now>=x)return num; else return num+min(a[x]*2,len); } ll solve2(ll x) { ll now=n+1,num=0; while(now-k>=x) { now-=k; num+=min((len-a[now])*2,len); } if(now<=x)return num; else return num+min((len-a[x])*2,len); } 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]; ans=solve1(n); for(ll i=0;i<=n;++i){ ans=min(ans,solve1(i)+solve2(i+1)); // printf("%lld %lld %lld\n",i,solve1(i),solve2(i+1)); } return ans; }

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

boxes.cpp: In function 'long long int solve1(long long int)':
boxes.cpp:27:14: warning: declaration of 'x' shadows a global declaration [-Wshadow]
   27 | ll solve1(ll x)
      |              ^
boxes.cpp:26:12: note: shadowed declaration is here
   26 | ll n,k,ans,x,len,a[N],b[N];
      |            ^
boxes.cpp: In function 'long long int solve2(long long int)':
boxes.cpp:38:14: warning: declaration of 'x' shadows a global declaration [-Wshadow]
   38 | ll solve2(ll x)
      |              ^
boxes.cpp:26:12: note: shadowed declaration is here
   26 | ll n,k,ans,x,len,a[N],b[N];
      |            ^
#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...