제출 #800709

#제출 시각아이디문제언어결과실행 시간메모리
800709firewater선물상자 (IOI15_boxes)C++14
50 / 100
42 ms9916 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 num=0; while(x-k+1>=1) { num+=min(a[x]*2,len); x-=k; } if(x<1)return num; else return num+min(a[x]*2,len); } ll solve2(ll x) { ll now=n+1,num=0; while(x+k-1<=n) { num+=min((len-a[x])*2,len); x+=k; } if(x>n)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:32:14: warning: declaration of 'x' shadows a global declaration [-Wshadow]
   32 | ll solve1(ll x)
      |              ^
boxes.cpp:31:12: note: shadowed declaration is here
   31 | ll n,k,ans,x,len,a[N],b[N];
      |            ^
boxes.cpp: In function 'long long int solve2(long long int)':
boxes.cpp:43:14: warning: declaration of 'x' shadows a global declaration [-Wshadow]
   43 | ll solve2(ll x)
      |              ^
boxes.cpp:31:12: note: shadowed declaration is here
   31 | ll n,k,ans,x,len,a[N],b[N];
      |            ^
boxes.cpp:45:8: warning: unused variable 'now' [-Wunused-variable]
   45 |     ll now=n+1,num=0;
      |        ^~~
#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...