제출 #20892

#제출 시각아이디문제언어결과실행 시간메모리
20892baneling100선물상자 (IOI15_boxes)C++98
100 / 100
426 ms39536 KiB
#include "boxes.h" #include <algorithm> using namespace std; long long Ans; long long delivery(int N, int K, int L, int p[]) { int i, j, half; long long res; half=upper_bound(p,p+N,L/2)-p-1; for(i=half ; i>=0 ; i-=K) Ans+=2*p[i]; for(i=half+1 ; i<N ; i+=K) Ans+=2*(L-p[i]); for(i=0 ; i<K ; i++) { res=L; for(j=half-i-1 ; j>=0 ; j-=K) res+=2*p[j]; for(j=half-i+K ; j<N ; j+=K) res+=2*(L-p[j]); Ans=min(Ans,res); } return Ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:13:34: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
     half=upper_bound(p,p+N,L/2)-p-1;
          ~~~~~~~~~~~~~~~~~~~~~~~~^~
#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...