제출 #250073

#제출 시각아이디문제언어결과실행 시간메모리
250073hhh07선물상자 (IOI15_boxes)C++14
0 / 100
1 ms384 KiB
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <utility> #include <set> #include <cmath> #include <climits> #include <cstring> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; ll delivery(int n, int k, int l, int pos[]){ ll dp1[n], dp2[n]; for (ll i = 0; i < n; i++){ if (i >= k) dp1[i] = dp1[i - k] + 2*pos[i]; else dp1[i] = 2*pos[i]; } for (ll i = n - 1; i >= 0; i--){ int curr = (n - 1) - i; if (curr >= k) dp2[curr] = dp2[curr - k] + 2*(l - pos[i]); else dp2[curr] = 2*(l - pos[i]); } ll res = LLONG_MAX; for (ll i = 0; i < n; i++){ int j = (n - i - 2); res = min(res, dp1[i] + dp2[j]); if (j >= k) res = min(res, dp1[i] + l + dp2[j - k]); } return res; }

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

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:27:28: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
         int curr = (n - 1) - i;
                    ~~~~~~~~^~~
boxes.cpp:35:24: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
         int j = (n - i - 2);
                 ~~~~~~~^~~~
#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...