제출 #1032563

#제출 시각아이디문제언어결과실행 시간메모리
1032563socpite선물상자 (IOI15_boxes)C++17
0 / 100
38 ms78712 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; const int maxn = 1e7+5; const long long INF = 1e18; long long cnt[maxn], ans[maxn], dp[maxn]; long long delivery(int N, int K, int L, int p[]) { for(int i = 0; i < N; i++)cnt[p[i]]++; N -= cnt[0]; int crr = 0; for(int i = 1; i < L; i++){ for(int _ = 0; _ < cnt[i]; _++){ dp[crr++%K] += i + min(i, L - i); ans[crr] = dp[(crr-1)%K]; } } memset(dp, 0, sizeof(dp)); crr = 0; long long re = INF; for(int i = 1; i < L; i++){ for(int _ = 0; _ < cnt[L-i]; _++){ dp[crr++%K] += i + min(i, L - i); re = min(re, dp[(crr-1)%K] + ans[N - crr]); } } return re; }

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

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:12:7: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   12 |     N -= cnt[0];
      |     ~~^~~~~~~~~
#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...