제출 #420099

#제출 시각아이디문제언어결과실행 시간메모리
420099temurbek_khujaev선물상자 (IOI15_boxes)C++17
100 / 100
531 ms70500 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long delivery(int N, int K, int L, int p[]) { long long ans = 1ll * N * L; int mid = lower_bound(p, p + N, (L + 1) / 2) - p; for (int i = max(-1, mid - K - 2); i < min(N, mid + K + 2); i++) { long long cur = 0; int x = i; int y = i + 1; while (x >= 0) { cur += min(L, p[x] * 2); x -= K; } while (y < N) { cur += min(L, (L - p[y]) * 2); y += K; } ans = min(ans, cur); } return ans; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:8:50: warning: conversion from 'long int' to 'int' may change value [-Wconversion]
    8 |     int mid = lower_bound(p, p + N, (L + 1) / 2) - p;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
#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...