제출 #563583

#제출 시각아이디문제언어결과실행 시간메모리
563583hoanghq2004선물상자 (IOI15_boxes)C++14
10 / 100
40 ms340 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include "boxes.h" using namespace __gnu_pbds; using namespace std; template <typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>; const int N = 1e7 + 10; long long f[N], g[N]; int p[N]; long long delivery(int n, int k, int l, int P[]) { for (int i = 0; i < n; ++i) p[i + 1] = P[i]; for (int i = 1; i <= n; ++i) f[i] = f[max(0, i - k)] + 2 * p[i]; for (int i = n; i >= 1; --i) g[i] = g[min(n + 1, i + k)] + 2 * (l - p[i]); long long ans = 1e18; k = min(k, n); for (int i = 1; i <= n; ++i) ans = min(ans, f[i] + g[i + 1]); for (int i = 1; i <= n; ++i) { for (int j = i; j <= n; ++j) { int t = ceil(1.0L * (j - i + 1) / k); ans = min(ans, f[i - 1] + g[j + 1] + 1LL * t * l); } } return ans; } // //int main() { // freopen("test.inp", "r", stdin); // ios :: sync_with_stdio(0); cin.tie(0); // int n, k, l; // cin >> n >> k >> l; // int p[n]; // for (int i = 0; i < n; ++i) cin >> p[i]; // cout << delivery(n, k, l, p); //}

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:29:25: warning: conversion from 'long double' to 'int' may change value [-Wfloat-conversion]
   29 |             int t = ceil(1.0L * (j - i + 1) / k);
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...