제출 #619421

#제출 시각아이디문제언어결과실행 시간메모리
619421Hazem선물상자 (IOI15_boxes)C++14
100 / 100
543 ms277488 KiB
#include <bits/stdc++.h> #define LL long long using namespace std; const LL LINF = 1e18; LL a[10000010],pr[10000010],su[10000010]; vector<LL>vec[2]; LL n,k,L1; long long delivery(int N, int K, int L, int p[]) { n = N,k = K; L1 = L; for(int i=1;i<=n;i++) a[i] = p[i-1]; for(int i=1;i<=n;i++) if(i<=k) pr[i] = a[i]*2; else pr[i] = pr[i-k] + a[i]*2; for(int i=n;i>=1;i--) if(n-i+1<=k) su[i] = (L-a[i])*2; else su[i] = su[i+k] + (L-a[i])*2; LL ans = min(pr[n],su[1]); for(int i=1;i<=n;i++){ ans = min(ans,pr[i-1]+su[i]); ans = min(ans,pr[i-1]+su[i+k]+L); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:27:15: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   27 |     for(int i=n;i>=1;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...