제출 #617079

#제출 시각아이디문제언어결과실행 시간메모리
617079beedle선물상자 (IOI15_boxes)C++17
100 / 100
609 ms372260 KiB
#include "boxes.h" #include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <set> #include <iterator> #include <stack> #include <map> #include <math.h> #include <bitset> #include <deque> #include <string> #include <tuple> #include <queue> #include <numeric> #include <unordered_set> #include <unordered_map> #include <random> #include <chrono> #define pi 3.141592653589793238 #define ll long long #define ld long double #define rep(i, a, b) for (long long i = a; i <= b; i++) #define mod 1000000007ll #define INF 1000000000000000000 #define pb push_back #define ff first #define ss second #define endl '\n' #define all(x) (x).begin (), (x).end () #define sz(x) (ll) (x).size () #define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin()) #define rank rnk #define log lg #define fast \ ios_base::sync_with_stdio (false); \ cin.tie (NULL); \ cout.tie (NULL) using namespace std; long long delivery(int N, int K, int L, int P[]) { ll n=N, k=K, l=L, p[n]; rep(i,0,n-1) p[i]=P[i]; ll dp[n]; ll rdp[n]; for(int i=0;i<n;i++) { dp[i]=(i-k>=0?dp[i-k]:0)+min(l,2*p[i]); } for(int i=n-1;i>=0;--i) { rdp[i]=(i+k<n?rdp[i+k]:0)+min(l,2*(l-p[i])); } ll ret=min(dp[n-1],rdp[0]); rep(i,0,n-2) ret=min(ret,dp[i]+rdp[i+1]); return ret; } // signed main() // { // int n=3; // int k=2; // int l=8; // int p[]={1,2,5}; // cout<<delivery(n,k,l,p); // }

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

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