Submission #668900

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6689002022-12-05 07:20:14AstraytBoxes with souvenirs (IOI15_boxes)C++17
25 / 100
1 ms212 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int,int>
#define All(x) x.begin(), x.end()
ll delivery(int N, int K, int L, int pos[]){
ll ans = 0;
vector<ll> lp, rp;
for(int i = 0; i < N; ++i){
if(pos[i] == 0) continue;
if(pos[i] <= L / 2) lp.pb(pos[i]);
else rp.pb(L - pos[i]);
}
reverse(rp.begin(), rp.end());
int lN = lp.size(), rN = rp.size();
vector<ll> dpl(lN + 1, 0), dpr(rN + 1, 0);
for(int i = 1; i <= lN; ++i){
if(i - K < 0) dpl[i] = lp[i - 1] * 2;
else dpl[i] = dpl[i - K] + lp[i - 1] * 2;
}
for(int i = 1; i <= rN; ++i){
if(i - K < 0) dpr[i] = rp[i - 1] * 2;
else dpr[i] = dpr[i - K] + rp[i - 1] * 2;
}
ans = dpl[lN] + dpr[rN];
for(int i = 0; i <= K; ++i){
int iL = lN - i, iR = rN - K + i;
if(iL < 0 || iR < 0) continue;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

boxes.cpp: In function 'long long int delivery(int, int, int, int*)':
boxes.cpp:17:18: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   17 |  int lN = lp.size(), rN = rp.size();
      |           ~~~~~~~^~
boxes.cpp:17:34: warning: conversion from 'std::vector<long long int>::size_type' {aka 'long unsigned int'} to 'int' may change value [-Wconversion]
   17 |  int lN = lp.size(), rN = rp.size();
      |                           ~~~~~~~^~
#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...