이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "boxes.h"
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
ll dp1[10000001], dp2[10000001];
long long delivery(int N, int K, int L, int p[]) {
vector<ll> pp;
FOR(i,0,N){
if (p[i] != 0) pp.push_back(p[i]);
}
N = pp.size();
FOR(i,0,K){
dp1[i] = pp[i]*2;
}
FOR(i,K,N){
dp1[i] = dp1[i-K] + pp[i]*2;
}
FORNEG(i,N-1, N-K-1){
dp2[i] = (L-pp[i])*2;
}
FORNEG(i, N-K-1, -1){
dp2[i] = dp2[i+K] + (L-pp[i])*2;
}
ll ans = dp2[0];
FOR(i,0,N){
ans = min(ans, dp1[i] + dp2[i+1]);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:23:16: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
23 | N = pp.size();
| ~~~~~~~^~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |